如何获取在IOS应用程序中发送图像的URL

时间:2014-05-05 05:12:54

标签: ios alassetslibrary

我正在使用IOS应用程序,当我从iPhone模拟器中选择一个图像时,我想要获取该图像的URL(网址路径)。当我尝试使用我的下面的代码时,我得到一个数组url并没有从该数组获取特定的字符串值。请帮助我,以这种方式,我能够检索图像的URL,而不是我得到的代码的数组。

NSURL *imageURL = [info valueForKey:UIImagePickerControllerReferenceURL];
        ALAssetsLibraryAssetForURLResultBlock resultblock = ^(ALAsset *myasset)
        {
            ALAssetRepresentation *representation = [myasset defaultRepresentation];
            NSString *fileName = [representation filename];
            NSLog(@"fileName : %@",fileName);
        };

        ALAssetsLibrary* assetslibrary = [[ALAssetsLibrary alloc] init];
        [assetslibrary assetForURL:imageURL
                       resultBlock:resultblock
                      failureBlock:nil];
        NSLog(@"ALAssetsLibrary : %@",assetslibrary);

请给我一个解决方案,我该如何检索该图像的网址? 提前谢谢。

0 个答案:

没有答案
相关问题