在我的应用中,应用程序允许用户捕获图像/录制视频。但我不知道如何检查以下方法的结果。
- (void) imagePickerController: (UIImagePickerController *) picker
didFinishPickingMediaWithInfo: (NSDictionary *) info {
}
您的解决方案永远受到赞赏。谢谢。
答案 0 :(得分:2)
这里你需要的是:
- (void) imagePickerController: (UIImagePickerController *) picker
didFinishPickingMediaWithInfo: (NSDictionary *) info {
NSString *mediaType = info[UIImagePickerControllerMediaType];
if ([mediaType isEqualToString:(NSString *)kUTTypeImage]) {
// Media is an image
UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];
}
else if ([mediaType isEqualToString:(NSString *)kUTTypeVideo] || [mediaType isEqualToString:(NSString *)kUTTypeMovie])
{
// Media is a video
// Video URL
NSURL *localUrl = (NSURL *)[info valueForKey:UIImagePickerControllerMediaURL];
}
}