Ios 使用QLEVIEWCONTROLLER显示ALASET

Ios 使用QLEVIEWCONTROLLER显示ALASET,ios,alasset,qlpreviewcontroller,Ios,Alasset,Qlpreviewcontroller,我想使用QLPreviewController显示照片流中的图像集 QLViewController需要一个NSURL来显示该项 当它是一个文件URL,如 /var/mobile/Applications/5374……9E0/Documents/image33.png 我有一套 但是,使用[[asset defaultRepresentation]url]会给我一个NSURL类型 资产-library://asset/asset.JPG?id=00000000-0000-0000-0000-00

我想使用QLPreviewController显示照片流中的图像集 QLViewController需要一个NSURL来显示该项

当它是一个文件URL,如 /var/mobile/Applications/5374……9E0/Documents/image33.png

我有一套 但是,使用[[asset defaultRepresentation]url]会给我一个NSURL类型
资产-library://asset/asset.JPG?id=00000000-0000-0000-0000-0000000000 75&ext=JPG

但这不显示QLViewController,只显示加载

有什么想法吗?
提前感谢

也许不是最快、最有效的方法,但它解决了问题。请使用NSFilemanager而不是NSTemporaryDirectory,如文档中所示:-)确保链接到ImageIO.framework

    #import <ImageIO/ImageIO.h>

    ....
    NSURL *outURLToUseWithQLPreviewController = nil;

    ALAsset *myAsset = ... // received somehow
    ALAssetRepresentation *represent = myAsset.defaultRepresentation;
    CGImageRef representFullScreen = represent.fullScreenImage;

    NSString *tempDir = NSTemporaryDirectory();
    NSString *imagePath = [tempDir stringByAppendingPathComponent:represent.filename];
    NSURL *tempURL = [NSURL fileURLWithPath:imagePath];

    CGImageDestinationRef destination = CGImageDestinationCreateWithURL((__bridge CFURLRef)(tempURL), (__bridge CFStringRef)(represent.UTI), 1, NULL);
    CGImageDestinationAddImage(destination, representFullScreen, nil);
    if ( CGImageDestinationFinalize(destination) ) {
        outURLToUseWithQLPreviewController = tempURL;
    }
    return outURLToUseWithQLPreviewController;
#导入
....
NSURL*outURLToUseWithQLPreviewController=nil;
ALAsset*我的资产=…//不知怎么收到的
ALAssetRepresentation*Representation=myAsset.defaultRepresentation;
CGImageRef representFullScreen=表示.fullScreenImage;
NSString*tempDir=NSTemporaryDirectory();
NSString*imagePath=[tempDir stringByAppendingPathComponent:representation.filename];
NSURL*tempURL=[NSURL fileURLWithPath:imagePath];
CGImageDestinationRef destination=CGImageDestinationCreateWithURL((u桥CFURLRef)(tempURL),(u桥CFStringRef)(表示.UTI),1,空);
CGImageDestinationAddImage(目标,代表全屏,无);
如果(CGImageDestinationFinalize(目的地)){
OuturlToUserWithQlPreviewController=tempURL;
}
返回OuturlToUserWithQlPreviewController;