0
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)img editingInfo:(NSDictionary *)editInfo {
[self dismissViewControllerAnimated:YES completion:nil];
NSURL *kittenFileURL = [[NSBundle mainBundle] URLForResource:img withExtension:nil];
}

This is my code. The warning i'm getting it Incompatible pointer types sending 'UIImage *__strong' to parameter of type 'NSString *' When I go to collect the url of the user image to upload to dropbox, it crashes the app. Any ideas?

1 Answer 1

1

URLForResource: is expecting a string whereas you are passing an image. That is the error. You need to pass a string there.

[[NSBundle mainBundle] URLForResource:stringPath withExtension:nil];

Not sure what you were planning to do with that, but URLForResource: param is expecting a path or file name and not a UIImage. For more details check the apple documentation here.

Just a guess, do you want to get the media url for that image. In that case you need to do like this,

NSURL *kittenFileURL = [editInfo valueForKey:UIImagePickerControllerMediaURL];

The available keys are listed here.. For referenceURL you can use, [editInfo valueForKey:UIImagePickerControllerReferenceURL]

On a side note, imagePickerController:didFinishPickingImage:editingInfo: is deprecated and you should be using imagePickerController:didFinishPickingMediaWithInfo:.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.