4

在按下文档交互控制器按钮之一(即复制、打印等)后,我收到以下错误:

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
{

}
4

1 回答 1

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];
于 2013-01-17T15:07:53.323 回答