I am trying to get the name of the image which I have just captured from camera with following code. But [info objectForKey:@\"UIImagePickerControllerReferenceURL\"]>
Put the following code in didFinishPickingMediaWithInfo:
NSURL *mediaUrl;
NSString *imageURLString;
self.selectImage = [info valueForKey:UIImagePickerControllerEditedImage];
if (mediaUrl == nil) {
if (self.selectImage == nil) {
self.selectImage = [info valueForKey:UIImagePickerControllerOriginalImage];
DebugLog(@"Original image picked.");
}else {
DebugLog(@"Edited image picked.");
}
}
mediaUrl = (NSURL *)[info valueForKey:UIImagePickerControllerMediaURL];
imageURLString=[mediaUrl absoluteString];
DebugLog(@"Hi Image URL STRING : - %@",imageURLString);
if ([StringUtils string:imageURLString contains:@"PNG"] || [StringUtils string:imageURLString contains:@"png"]) {
self.isJPG = NO;
self.profileImageName = @"profileImageName.png";
} else if ([StringUtils string:imageURLString contains:@"JPG"] || [StringUtils string:imageURLString contains:@"jpg"]) {
self.isJPG = YES;
self.profileImageName = @"profileImageName.jpg";
}
When you set camera for kUTTypeMovie , then only you will get referenceurl and mediaurl. It will return null for kUTTypeImage.