我正在将视频文件添加到 iphone 模拟器路径,但它没有在图库中显示视频文件。如何将视频文件添加到模拟器,请指导。
下面是从图库中挑选视频的代码。
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
NSString* mediaType = [info objectForKey:UIImagePickerControllerMediaType];
if ( [mediaType isEqualToString:@"public.movie" ])
{
// NSLog(@"Picked a movie at URL %@", [info objectForKey:UIImagePickerControllerMediaURL]);
// NSURL *url = [info objectForKey:UIImagePickerControllerMediaURL];
// NSLog(@"> %@", [url absoluteString]);
if (CFStringCompare ((__bridge CFStringRef) mediaType, kUTTypeMovie, 0)
== kCFCompareEqualTo)
{
//NSString *moviePath = [[info objectForKey:UIImagePickerControllerMediaURL] path];
// NSLog(@"%@",moviePath);
NSURL *videoUrl=(NSURL*)[info objectForKey:UIImagePickerControllerMediaURL];
NSData *webData = [NSData dataWithContentsOfURL:videoUrl];
[self post:webData];
if([profile isEqualToString:@"friend"])
{
[self callServerFriend];
}
if([profile isEqualToString:@"public"])
{
[self callServerPublic];
}
}
}
}