0
我试图从ALAsset
之前为iOS5创建宽高比缩略图(ALAssetDefaultRepresentation aspectRatioThumbnail
直到ios5才实现)。我有下面的代码和它给我一个错误由于某些原因:尝试从图像I/O创建AspectRatio缩略图时出错
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
任何人都知道这是怎么回事?
我已经提出了一个关于如何从ALAsset生成一个答案:http://stackoverflow.com/questions/11765340/generating-custom-thumbnail-from-alassetrepresentation/13941431#13941431 –