0
我想從庫中選擇視頻。這是我的代碼。如何從iPhone庫中獲取視頻
picker1 = [[UIImagePickerController alloc] init];
picker1.delegate = self;
NSArray *mediaTypesAllowed = [UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
picker1.sourceType=UIImagePickerControllerSourceTypeSavedPhotosAlbum;
picker1.mediaTypes = mediaTypesAllowed;
[self presentModalViewController:picker1 animated:YES];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
[picker dismissModalViewControllerAnimated:YES];
if ([picker isEqual:picker1])
{
NSString *mediaType = [info valueForKey:UIImagePickerControllerMediaType];
if([mediaType isEqualToString:@"public.movie"]){
NSLog(@"%@",info);
}
}
問題是,當我從庫中選擇視頻,模擬器得到忌用。即使代表方法didFinishPickingMediaWithInfo不呼叫
在此先感謝。
你的代碼看起來不錯...嘗試刪除'NSLog'線或評論它..並且還寫picker1代替當您關閉它時.. – Maulik
請參閱[Accessing_the_iOS_5_iPhone_Camera_and_Photo_Library](http://www.techotopia.com/index.php/Accessing_the_iOS_5_iPhone_Camera_and_Photo_Library)鏈接並檢查您的代碼。 –