我正在尝试在弹出窗口中显示 UiImagePicker,因为它应该为 iPad 完成。But when a picture is selected and imagePickerController:didFinishPickingMediaWithInfo: is triggered, I get the following log:
未找到命名服务“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];
}
我可能会错过什么或做错了什么?谢谢!