gpt4 book ai didi

ios - "imagePickerController:didFinishPickingMediaWithInfo:""UIImagePickerControllerMediaURL"信息字典中的关键异常行为

转载 作者:可可西里 更新时间:2023-11-01 05:42:42 27 4
gpt4 key购买 nike

在“imagePickerController:didFinishPickingMediaWithInfo:”中,信息字典有时没有关键字“UIImagePickerControllerMediaURL”。有时确实有。我尝试清理目标,但没有帮助。此外,工作流程始终相同:我遵循相同的步骤并从库中选择相同的视频文件。有时信息字典中有“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"信息字典中的关键异常行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4562251/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com