My iPhone app sends a custom URL file via AirDrop to my iPad app. The URL has an extension of .fdre. When sent the iPad app opens. However, Application function to handle receiving the custom file in AppDelegate never seems to get hit. Any help would be greatly appreciated.
I have this in my "sending" app:
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)
}
I have this in the AppDelegate of my receiving app:
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
if url.pathExtension == "fdre" {
print("got result")
}
return true
}
I have this in my receiving app for the document types:
cheers kbjb