0

我正在使用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];  
4

1 回答 1

0

也许定义self.documentControler.delegate

并添加

#pragma mark - UIDocumentInteractionControllerDelegate

- (UIViewController *) documentInteractionControllerViewControllerForPreview: (UIDocumentInteractionController *) controller {
    return self;
}
于 2020-05-21T19:42:47.070 回答