![](/img/trans.png)
[英]UIImagePickerController crashes app on iPad but not iPhone
[英]UIImagePickerController crashes on iPad simulator
我正在尝试在弹出窗口中显示UiImagePicker,因为它应该在iPad上完成。 但是当选择图片并触发imagePickerController:didFinishPickingMediaWithInfo:时 ,我得到以下日志:
找不到名为“ com.apple.PersistentURLTranslator.Gatekeeper”的服务。 资产已关闭或配置错误。 事情不会像您期望的那样运作。
这是我的代码:
- (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];
}
我会丢失什么或做错什么? 谢谢!
这可能是Xcode for ML中的错误 。 尝试退出模拟器并重新启动,看看是否有帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.