刚刚下载了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];
}
}

最佳答案

为了消除此警告,我更新了这段代码:

if (_returnsOriginalImage) {
    imgRef = [assetRep fullResolutionImage];
    orientation = [assetRep orientation];
} else {
    imgRef = [assetRep fullScreenImage];
}

要以下内容:
if (_returnsOriginalImage) {
    imgRef = [assetRep fullResolutionImage];

    NSNumber *orientationValue = [asset valueForProperty:@"ALAssetPropertyOrientation"];
    if (orientationValue != nil) {
        orientation = [orientationValue intValue];
    }

} else {
    imgRef = [assetRep fullScreenImage];
}

10-07 19:41