2

我正在为 iPad 开发 iOS 应用程序,我正在使用一个名为 Grabkit 的存储库来获取来自不同服务(如 Instagram 和 Flicker)的图像以及来自相机胶卷的图像。问题是,当用户从我得到的卷中选择一张图片和这样的 URL 时: assets-library://asset/asset.JPG?id=DCFB9E49-93AA-49E3-89C8-2EE64AE2C4C6&ext=JPG 我已经尝试了一些从这种路径获取图像但没有人工作的代码,例如:

 ALAssetsLibrary* library = [[ALAssetsLibrary alloc] init];

    // Ask for the "Asset" for the URL. An asset is a representation of an image in the Photo application.
    [library assetForURL:originalImage.URL
             resultBlock:^(ALAsset *asset) {

                 // Here, we have the asset, let's retrieve the image from it

                 CGImageRef imgRef = [[asset defaultRepresentation] fullResolutionImage];
                 /* Instead of the full res image, you can ask for an image that fits the screen
                  CGImageRef imgRef  = [[asset defaultRepresentation] fullScreenImage];
                  */

                 // From the CGImage, let's build an UIImage
               imatgetemporal = [UIImage imageWithCGImage:imgRef];


             } failureBlock:^(NSError *error) {

                 // Something wrong happened.

             }];

我的代码有问题吗?我必须尝试其他代码吗?

4

0 回答 0