- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editInfo {
userURL = [editInfo objectForKey:UIImagePickerControllerMediaURL];
userImage = image;
userImageView.image=userImage;
[self dismissViewControllerAnimated:YES completion:nil];}
然后我获取 NSURL userURL,并将其放在 UIActivityViewController 中以用于上传图像。但是,这永远不会起作用,并且在尝试上传时总是失败(null)。但是,当我使用 xcode 项目中包含的预设图像和以下代码时,它始终可以正常工作并正确上传:
NSURL *url = [[NSBundle mainBundle] URLForResource:@"kitten.jpg" withExtension:nil];
如果有帮助,我正在使用https://github.com/goosoftware/GSDropboxActivity
当我使用 UIImagePickerControllerReferenceURL 而不是 UIImagePickerControllerMediaURL 时,我收到以下错误:[警告] DropboxSDK:文件不存在 (/asset.JPG) 无法上传 assets-library://asset/asset.JPG?id=EECAF4D0-A5ED- 40E7-8E6F-3A586C0AB06E&ext=JPG