English 中文(简体)
资产图书馆:地点服务迅速。 如何避免这种情况?
原标题:AssetsLibrary: Location Services prompt. How did Instagram avoid it?

我正在做一个在资产图书馆使用照片和录像的照片,我只是试图一劳永逸地确定,如果在要求用户允许查阅地点数据以便获取这些资产方面有任何办法。 我的理解是,EXIF数据包括全球定位系统信息,这对我来说是足够的。

注:我通过StackOverflow进行了搜索,我也发现了类似问题,我并不是说这个职位只是要增加一个。 我特别要问一(表面)反面。

在第一次使用“In”时,我得以通过我的照片集浏览、选择照片、编辑和分享,而无需随时随地服务。 我只是在选择点击被称作“Enable Geotagging”的纽顿语时才发出。 如果我不点击 but子,那么就象我看上去,“Inst”甚至出现在我所在的地点服务科。

我的问题是,如何消除这种情况? 没有人有什么想法? 我要指出,如果我能够 mi笑其执行,那么,如果我的使用者不说这样做,他们就没有离开照相资产。

问题回答

the explanation is quite simple. Instagram uses the UIImagePickerController. UIImagePickerController works without Location Services enabled, but you don t get EXIF data using this method. UIImagePickerController can retrieve metadata (incl. GPS) only through the UIImagePickerControllerReferenceURL. UIImagePickerControllerReferenceURL you have to pass then AssetsLibrary methods, which needs again location services enabled. Cheers,

Hendrik

正如有人提到的那样,阅读UIImagePickerControllerReferenceURL会迅速启动地点服务。 如果你只需要图像数据,而不是元数据,那么你就可以从UIImagePickerController 和UIImagePickerController那里获得。 Edited 相反,图像钥匙(Im 检查EditedImage,然后检查EditedImage如果无效的话。) 这并不要求使用资产图书馆,也不要求进入地点。

这里指的是我如何在我看来使用这一图像,包括保存当地图像复制本以供进一步编辑:

- (void)imagePickerController:(UIImagePickerController *)controller didFinishPickingMediaWithInfo:(NSDictionary *)info {
    // get the selected photo as a UIImage
    UIImage *photo = [info objectForKey:@"UIImagePickerControllerEditedImage"];
    if (!photo) {
        photo = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
    }

    // save the photo to the app s Documents folder
    if (photo) {
        NSString *extension = @"jpg";
        NSString *filename = [NSString stringWithFormat:@"%@.%@", self.defaultTitle, extension]; // self.defaultTitle is defined elsewhere in my app
        NSString *path = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:filename];
        [UIImageJPEGRepresentation(photo, 0.8) writeToFile:path atomically:YES];
    }
}




相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签