如何仅访问 UIImagePickerControllerReferenceURL 的 MIME ext 部分?这是我在 NSLog -(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info 时得到的
UIImagePickerControllerReferenceURL = "assets-library://asset/asset.PNG?id=F61B754A-705C-4BFB-9965-DE34C7B93A2B&ext=PNG";
我只想访问 MIME 类型。当我使用以下方式将图像发送到我的网络服务器时:
NSData *imageData = UIImageJPEGRepresentation(_selectedImage, 1.0);
//non-important ASIFormDataRequest set-up
[request setData:imageData withFileName:uniqueString andContentType:@"image/jpeg" forKey:@"photo"];
画面一团糟。但是当我使用:
NSData *imageData = UIImagePNGRepresentation(_selectedImage);
//non-important ASIFormDataRequest set-up
[request setData:imageData withFileName:uniqueString andContentType:@"image/png" forKey:@"photo"];
图片很好。但是我上传的所有照片都不会是PNG。