ALAsset
我正在尝试从iOS5 之前的版本创建纵横比缩略图(ALAssetDefaultRepresentation aspectRatioThumbnail
直到 ios5 才实现)。我有以下代码,由于某种原因它给了我一个错误:
CGImageRef imref;
NSURL* url = [self.photoAsset.defaultRepresentation url];
NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys:
(id)kCFBooleanTrue, kCGImageSourceShouldAllowFloat,
(id)kCFBooleanTrue, kCGImageSourceCreateThumbnailWithTransform,
(id)kCFBooleanTrue, kCGImageSourceCreateThumbnailFromImageAlways,
[NSNumber numberWithInteger:1024], kCGImageSourceThumbnailMaxPixelSize, nil];
CGImageSourceRef src = CGImageSourceCreateWithURL((CFURLRef)url, NULL);
imref = CGImageSourceCreateThumbnailAtIndex(src, 0, (CFDictionaryRef) dictionary);
具体来说,我得到:
ImageIO: <ERROR> CGImageSourceCreateWithURL CFURLCreateDataAndPropertiesFromResource failed with error code -11.ImageIO: <ERROR> CGImageSourceCreateThumbnailAtIndex image source parameter is nil
有谁知道发生了什么?