IOS Swift 4 AppDelegate应用程序处理接收未命中的自定义URL空投文件
我的iPhone应用程序通过AirDrop向我的iPad应用程序发送一个自定义URL文件。URL的扩展名为.fdre。发送后,iPad应用程序将打开。然而,在AppDelegate中处理接收自定义文件的应用程序函数似乎从未被命中。任何帮助都将不胜感激 我的发送应用程序中有:IOS Swift 4 AppDelegate应用程序处理接收未命中的自定义URL空投文件,ios,swift,airdrop,uiactivitytypeairdrop,Ios,Swift,Airdrop,Uiactivitytypeairdrop,我的iPhone应用程序通过AirDrop向我的iPad应用程序发送一个自定义URL文件。URL的扩展名为.fdre。发送后,iPad应用程序将打开。然而,在AppDelegate中处理接收自定义文件的应用程序函数似乎从未被命中。任何帮助都将不胜感激 我的发送应用程序中有: func exportToURL (data : String) -> URL { var input : String = "" let url = self.getDocumen
func exportToURL (data : String) -> URL {
var input : String = ""
let url = self.getDocumentsDirectory().appendingPathComponent("FUNduroResult.fdre")
do {
try data.write(to: url, atomically: true, encoding: .utf8)
input = try String(contentsOf: url)
print(input)
print(url)
} catch {
print(error.localizedDescription)
}
return url
}
@IBAction func airdropButton(_ sender: Any) {
let text = formatDataAsCSV()
let url = exportToURL(data: text)
let activity = UIActivityViewController(
activityItems: ["Check out this result for the FUNduro.", url],
applicationActivities: nil
)
activity.popoverPresentationController?.barButtonItem = sender as? UIBarButtonItem
present(activity, animated: true, completion: nil)
}
我的接收应用程序的AppDelegate中有以下内容:
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
if url.pathExtension == "fdre" {
print("got result")
}
return true
}
我的接收应用程序中有以下文档类型:
干杯kbjbOk我自己发现了问题。所有这些都与新场景有关。删除场景处理类并调用AppDelegate函数。确定自己发现了问题。所有这些都与新场景有关。移除场景处理类并调用AppDelegate函数。