ios – “imagePickerController:didFinishPickingMediaWithInfo:”“UIImagePickerControllerMediaURL”信息字典中的关键奇怪行为

ios – “imagePickerController:didFinishPickingMediaWithInfo:”“UIImagePickerControllerMediaURL”信息字典中的关键奇怪行为,第1张

概述在“imagePickerController:didFinishPickingMediaWithInfo:”中,信息字典有时没有键“UI ImagePickerControllerMediaURL”.有时确实有.我试过清理目标,但这没有帮助.此外,工作流程始终相同:我按照相同的步骤从库中选择相同的视频文件.有时候信息字典中有“UIImagePickerControllerMediaURL”键,有 在“imagePickerController:dIDFinishPickingMediawithInfo:”中,信息字典有时没有键“UI ImagePickerControllerMediaURL”.有时确实有.我试过清理目标,但这没有帮助.此外,工作流程始终相同:我按照相同的步骤从库中选择相同的视频文件.有时候信息字典中有“UIImagePickerControllerMediaURL”键,有时“UIImagePickerControllerMediaURL”在同一文件的信息字典本身中不存在.无法理解.有人可以帮忙吗?

当我从照片库中选择视频/电影时,这是我的NSLog信息词典:

info dict = {    UIImagePickerControllerMediaType = "public.movIE";    UIImagePickerControllerReferenceURL = "assets-library://asset/asset.MOV?ID=1000000466&ext=MOV";}
解决方法
- (voID)imagePickerController:(UIImagePickerController *)picker dIDFinishPickingMediawithInfo:(NSDictionary *)info{     NSMutableDictionary *infoDict = [[NSMutableDictionary alloc]init];    Nsstring *mediaType = [info objectForKey:UIImagePickerControllerMediaType];    if ([mediaType isEqualToString:@"public.image"]){        UIAlertVIEw *myAlertVIEw = [[UIAlertVIEw alloc] initWithTitle:@"" message:@"You Select a image Please select MovIE" delegate:self cancelbuttonTitle:@"OK" otherbuttonTitles:nil];        [myAlertVIEw show];        [myAlertVIEw release];    }    else if ([mediaType isEqualToString:@"public.movIE"]){        NSURL *vIDeoURL = [info objectForKey:UIImagePickerControllerMediaURL];        mAppDelegate.uploadType = @"VIDeo";        NSData *webData = [NSData dataWithContentsOfURL:vIDeoURL];        [infoDict setValue:webData forKey:@"VIDeoUrl"];        [infoDict setValue:[[mAppDelegate.userInfoArray objectAtIndex:1]valueForKey:@"user_ID"] forKey:@"user_ID"];        [[WakeUpParsing sharedInstance] assignSender:self];        [[WakeUpParsing sharedInstance] startParsingForVedioUploade:infoDict];    }    [picker dismissModalVIEwControllerAnimated:YES];    [infoDict release];}- (voID)imagePickerControllerDIDCancel:(UIImagePickerController *)picker{    // dismiss the image selection and close the program    [[picker parentVIEwController] dismissModalVIEwControllerAnimated:YES];}
总结

以上是内存溢出为你收集整理的ios – “imagePickerController:didFinishPickingMediaWithInfo:”“UIImagePickerControllerMediaURL”信息字典中的关键奇怪行为全部内容,希望文章能够帮你解决ios – “imagePickerController:didFinishPickingMediaWithInfo:”“UIImagePickerControllerMediaURL”信息字典中的关键奇怪行为所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1051225.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-25
下一篇 2022-05-25

发表评论

登录后才能评论

评论列表(0条)

保存