- (void)thumbnail:(NSNumber *)index{
__block NSNumber *number = [NSNumber numberWithInt:[index intValue]];
ALAssetsLibrary *library = [ALAssetsLibrary sharedALAssetsLibrary];
ALAssetsLibraryAssetForURLResultBlock resultblock = ^(ALAsset *myasset)
{
CGImageRef iref = [myasset thumbnail];
if (iref) {
[delegate thumbnailDidLoad:[UIImage imageWithCGImage:iref] withIndex:number];
}
NSLog(@"RESSSSSSSSSSSSSSSSSSSSSSSSSSSSSULT");
};
ALAssetsLibraryAccessFailureBlock failureblock = ^(NSError *myerror)
{
NSLog(@"Error, can't get image - %@",[myerror localizedDescription]);
};
NSString *mediaurl = @"assets-library://asset/asset.JPG?id=5AF4118C-947D-4097-910E-47E19553039C&ext=JPG";
NSURL *asseturl = [NSURL URLWithString:mediaurl];
[library assetForURL:asseturl resultBlock:resultblock failureBlock:failureblock];
NSLog(@"asseturl %@",asseturl);
}
這是我的代碼,我有問題與我的塊 - 他們在模擬器5.0下工作,但他們不工作在設備下,它不停止斷點和NSLogs不起作用。模擬器一切正常。注意:CLAuthorizationStatus == kCLAuthorizationStatusAuthorizedassetForURL與ios 5.0不工作與設備