UIDocumentInteractionController无法通过AirDrop发送文件

问题描述 投票:0回答:1

我正在使用UIDocumentInteractionController共享KML(Geo XML)文件。使用UIDocumentInteractionController时,可以在其他应用程序中打开KML文件。我可以通过电子邮件发送。但是,当我尝试通过AirDrop将其共享到我的Mac时,会出现此错误消息。我知道AirDrop可以在iPhne和Mac之间运行,因为我可以在其他应用程序中很好地使用它。实际上,我可以将我的应用程序中的KML共享给另一个应用程序,然后通过AirDrop从其他应用程序中共享KML文件。

Sender kSFOperationEventErrorOccured {  
    Error = "Error Domain=SFOperation Code=-1 \"Transfer failed.  Try again.\" UserInfo={NSLocalizedDescription=Transfer failed.  Try again.}";  
    Files =     (  
                {  
            FileBomPath = "./topoMapsExport.kml";  
            FileIsDirectory = 0;  
            FileName = "topoMapsExport.kml";  
            FileType = "com.trailbehind.kml";  
        }  
    );  
    ReceiverComputerName = "Stephen\U2019s MacBook Pro";  
    ReceiverID = 994fcdc90a7d;  
    ReceiverModelName = "MacBook Pro";  
    SessionID = 3C1A7DF67296;  
    TotalBytes = 11857;  
    UsePKZip = 0;  
    VerifiableIdentity = 0;  
}  

有人知道为什么通过AirDrop共享会失败吗?

这是我设置文档交互控制器的方式。

//Path is the path to my kml file.  The path does exist and it has the correct data in it.  
    NSURL* url = [NSURL fileURLWithPath:path];  

    self.documentController = [UIDocumentInteractionController interactionControllerWithURL:url];  
    self.documentController.UTI = @"com.google.earth.kml";  
    self.documentController.name = @"topoMapsExport.kml";  
    [self.documentController presentOptionsMenuFromRect:self.exportButton.frame inView:self.view animated:YES];  
ios uidocumentinteraction airdrop
1个回答
0
投票

也许定义self.documentControler.delegate

并添加

#pragma mark - UIDocumentInteractionControllerDelegate

- (UIViewController *) documentInteractionControllerViewControllerForPreview: (UIDocumentInteractionController *) controller {
    return self;
}
© www.soinside.com 2019 - 2024. All rights reserved.