How can I avoid the location service from AlassetLibrary?

Possible duplicate:
How can I avoid the location service in AlAssetLibrary? Can I retrieve files using AlAssetLibrary without using the location service?

Hi everyone, I am new to iphone and obj-c development. I use "ALAssetLibrary" in my application to extract images from a photo library. I determined that the < ALAssetPropertyLocation "key is only available if location services are enabled for the caller. This is the key to finding asset location information. But I do not use the" ALAssetPropertyLocation "property. I use only ALAssetPropertyURLs.

whenever I try to deploy my application on a new device, a window appears with the message "Location service required." can i hide the property "ALAssetPropertyLocation"?

I would really appreciate if someone could help me approach my problem correctly and, if possible, try some code sample.

Thanks in advance:)

this is my code:

//Getting image url from dictionary according to the user input NSURL *imageurl = [dict objectForKey: [youSaid text]]; //Getting asset from url typedef void (^ALAssetsLibraryAssetForURLResultBlock)(ALAsset *asset); typedef void (^ALAssetsLibraryAccessFailureBlock)(NSError *error); ALAssetsLibraryAssetForURLResultBlock resultblock = ^(ALAsset *myasset) { ALAssetRepresentation *rep = [myasset defaultRepresentation]; CGImageRef iref = [rep fullResolutionImage]; //Setting asset image to image view according to the image url [imageview setImage:[UIImage imageWithCGImage:iref]]; }; ALAssetsLibraryAccessFailureBlock failureblock = ^(NSError *myerror) { NSLog(@"Error, cant get image - %@",[myerror localizedDescription]); }; if(imageurl != nil) { ALAssetsLibrary *assetLibrary=[[ALAssetsLibrary alloc] init]; [assetLibrary assetForURL:imageurl resultBlock:resultblock failureBlock:failureblock]; } 
+7
source share
1 answer

The inclusion of "location services" is a requirement for using AssetsLibrary. The reason is that any photo / video in the Photo Library may contain geodata. This data is available not only through ALAssetPropertyURL, but also if you are reading raw data from an asset (using getBytes: fromOffset: length: error: Method of ALAssetsRepresentation). The reason is that it is not possible to remove the geodata metadata from the raw image data (in case the location services are disabled), I assume that a constructive decision was made to make the "location services" mandatory for using the AssetsLibrary library.

This requirement may confuse the user. So you need to do 2 things:

1) If the user denies access to location services, then an explicit message until your application needs this access and that the application does not actually determine the current position or any GPS / data.

2) Display clear instructions on how to enable location services as soon as the user clicks “NO” in the initial dialog box.

Greetings

Hendrick

+6
source

All Articles