刚刚下载了 ELCImagePicker,我现在在 ELCImagePickerController.m 中收到此警告
Implicit conversion from enumeration type 'ALAssetOrientation' (aka 'enum ALAssetOrientation) to different enumeration type 'UIImageOrientation' (aka 'UIImageOrientation')
引发警告的代码是:
orientation = [assetRep orientation];
如果它更具启发性,这是完整的功能:
- (void)selectedAssets:(NSArray *)assets
{
NSMutableArray *returnArray = [[NSMutableArray alloc] init];
for(ELCAsset *elcasset in assets) {
ALAsset *asset = elcasset.asset;
id obj = [asset valueForProperty:ALAssetPropertyType];
if (!obj) {
continue;
}
NSMutableDictionary *workingDictionary = [[NSMutableDictionary alloc] init];
CLLocation* wgs84Location = [asset valueForProperty:ALAssetPropertyLocation];
if (wgs84Location) {
[workingDictionary setObject:wgs84Location forKey:ALAssetPropertyLocation];
}
[workingDictionary setObject:obj forKey:UIImagePickerControllerMediaType];
//This method returns nil for assets from a shared photo stream that are not yet available locally. If the asset becomes available in the future, an ALAssetsLibraryChangedNotification notification is posted.
ALAssetRepresentation *assetRep = [asset defaultRepresentation];
if(assetRep != nil) {
if (_returnsImage) {
CGImageRef imgRef = nil;
//defaultRepresentation returns image as it appears in photo picker, rotated and sized,
//so use UIImageOrientationUp when creating our image below.
UIImageOrientation orientation = UIImageOrientationUp;
if (_returnsOriginalImage) {
imgRef = [assetRep fullResolutionImage];
orientation = [assetRep orientation];
} else {
imgRef = [assetRep fullScreenImage];
}
UIImage *img = [UIImage imageWithCGImage:imgRef
scale:1.0f
orientation:orientation];
[workingDictionary setObject:img forKey:UIImagePickerControllerOriginalImage];
}
[workingDictionary setObject:[[asset valueForProperty:ALAssetPropertyURLs] valueForKey:[[[asset valueForProperty:ALAssetPropertyURLs] allKeys] objectAtIndex:0]] forKey:UIImagePickerControllerReferenceURL];
[returnArray addObject:workingDictionary];
}
}
if (_imagePickerDelegate != nil && [_imagePickerDelegate respondsToSelector:@selector(elcImagePickerController:didFinishPickingMediaWithInfo:)]) {
[_imagePickerDelegate performSelector:@selector(elcImagePickerController:didFinishPickingMediaWithInfo:) withObject:self withObject:returnArray];
} else {
[self popToRootViewControllerAnimated:NO];
}
}