iOS JPEG图像旋转90度

我正在使用选择器视图从相册中选择图像。 我使用上面的代码:

-(void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{ updateImage = [info objectForKey:UIImagePickerControllerOriginalImage]; [self.view addSubview:[MUtility sharedObject].loadingView ]; [self dismissViewControllerAnimated:YES completion:nil]; 

}

之后,我上传到服务器,我使用此代码

 NSData *imageData = UIImageJPEGRepresentation(updateImage, 0.1); 

但是这个图像旋转了90度。 只有肖像照片旋转。 我怎么解决这个问题 ?

UIImage有一个imageOrientation属性,可用于检查和解决问题。找到此链接 。