我按下其中一个文档交互控制器按钮,即复制,打印等后出现以下错误:
Launch Services: Registering unknown app identifier com.apple.mobilemail failed
Launch Services: Unable to find app identifier com.apple.mobilemail
以下是创建交互控制器的代码 - URL等都是有效的,但是委托调用没有命中我的控制器,即使我已经实现了奇怪的委托方法:
UIDocumentInteractionController *documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:fileURL];
documentInteractionController.delegate = self;
[documentInteractionController presentOptionsMenuFromRect:self.view.bounds
inView:self.view
animated:YES];
//None of these delegate methods are ever called which is weird:
- (void) documentInteractionController: (UIDocumentInteractionController *) controller
willBeginSendingToApplication: (NSString *) application
{
DebugLog(@"skldjfklsdjflksdjflsdk %@", application);
}
- (void) documentInteractionController: (UIDocumentInteractionController *) controller
didEndSendingToApplication: (NSString *) application
{
DebugLog(@"skldjfklsdjflksdjflsdk %@", application);
}
- (void)documentInteractionControllerDidDismissOptionsMenu:(UIDocumentInteractionController *)controller
{
}
- (void)documentInteractionControllerDidDismissOpenInMenu:(UIDocumentInteractionController *)controller
{
}
答案 0 :(得分:3)
我设法解决了这个问题 - 由于某种原因或其他原因,类中存在自动释放错误,并且在启动交互控制器时需要使用属性 - 非常奇怪,但对我来说非常有效:
@property (nonatomic, strong) UIDocumentInteractionController *documentInteractionController;
self.documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:fileURL];
self.documentInteractionController.delegate = self;
[self.documentInteractionController presentOptionsMenuFromRect:self.view.bounds
inView:self.view
animated:YES];