UIImagePickerController在iPad模拟器上崩溃

时间:2013-01-21 11:45:30

标签: ios ipad crash uiimagepickercontroller uipopovercontroller

我正在尝试在popover中显示UiImagePicker,因为它应该是为iPad完成的。但是当选择了一张图片并且触发了 imagePickerController:didFinishPickingMediaWithInfo:时,我得到以下日志:

找不到命名服务'com.apple.PersistentURLTranslator.Gatekeeper'。 assetsd已关闭或配置错误。事情不会像你期望的那样发挥作用。

这是我的代码:

- (void)viewDidLoad
{
   [super viewDidLoad];
   // Do any additional setup after loading the view from its nib.

   imagePickerController = [[UIImagePickerController alloc] init];
   imagePickerController.allowsEditing = NO;
   imagePickerController.delegate = self;
   imagePickerController.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
}

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
   // Check device
   if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
       [self dismissModalViewControllerAnimated:YES];
   }
   else {
       [popoverController dismissPopoverAnimated:YES];
   }

   // More code here to save the selected image
}

- (IBAction)showImagePicker:(id)sender
{
   if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
       [self presentModalViewController:imagePickerController animated:YES];
   }
   else {
       popoverController=[[UIPopoverController alloc]
                          initWithContentViewController:imagePickerController];
       [popoverController presentPopoverFromRect:((UIButton *)sender).frame
                                          inView:self.view
                        permittedArrowDirections:UIPopoverArrowDirectionAny
                                        animated:YES];
}

我可能会遗失或做错什么?谢谢!

1 个答案:

答案 0 :(得分:0)

这可能是Xcode for ML中的bug。尝试退出模拟器并重新启动,看看它是否有帮助。