我有一個應用程序,我想從照片廚房中選擇照片或視頻,並將它們上傳到服務器。這適用於ios 4。代碼如下:視頻上傳在iOS 4中,但不在iOS 5
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
image_selected = FALSE;
video_selected = FALSE;
imagePicker.mediaTypes = [NSArray arrayWithObjects:(NSString *)kUTTypeImage,(NSString *)kUTTypeMovie, nil];
NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType];
if ([mediaType isEqualToString:(NSString *)kUTTypeImage]) {
image_selected = TRUE;
imageFrame = [info objectForKey:UIImagePickerControllerOriginalImage];
NSLog(@"image1 has %@", imageFrame);
[image setImage:imageFrame];
}else if ([mediaType isEqualToString:(NSString *)kUTTypeMovie]) {
video_selected = TRUE;
videoURL = [info objectForKey:UIImagePickerControllerMediaURL];
NSLog(@"video has %@", videoURL);
MPMoviePlayerController *mp = [[MPMoviePlayerController alloc]initWithContentURL:videoURL];
videoFrame = [[mp thumbnailImageAtTime:0.0 timeOption:MPMovieTimeOptionNearestKeyFrame]retain];
[image setImage:videoFrame];
[mp release];
}
[[picker parentViewController] dismissModalViewControllerAnimated:YES];
}
但是,這在ios 5(模擬器或設備)中不起作用。當照片庫中的選擇按鈕被選中時,應用程序會凍結。
在這方面的任何幫助是非常必要的。
出於好奇,你使用iPhone模擬器或iPad模擬器? – DJPlayer
iPhone模擬器。問題是一樣的設備以及 –