Possible Duplicate:
How can i avoid Location service in AlAssetLibrary? Can i retrieve files using AlAssetLibrary without using Location Service?
Hi all, I am a newbie in iphone development and obj-c. i am using "ALAssetLibrary" in my Application to retrieve images from Photo Library. I identified that "ALAssetPropertyLocation"Property Key only available if location services are enabled for the caller. it is the key to retrieve the location information of the asset.But i am not using "ALAssetPropertyLocation"Property.i am using only ALAssetPropertyURLs.
whenever i am trying to deploy my Application in a new device there is a message box with the message "Location Service needed.." can i able to hide the "ALAssetPropertyLocation"Property?
I would really appreciate if someone could assist me in the correct way to approach my problem, and if possible any sample code to get my started.
Thank You 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];
}