0

我正在尝试使用下面的教程在我的应用程序中导入和打开自定义文件

https://chariotsolutions.com/blog/post/importing-data-via-custom-file-types-in/

这就是我的信息列表的样子 在此处输入图像描述

当我拖动扩展名为“.AMarkUp”的文件时,应用程序崩溃了

2019-03-11 11:28:37.661461+1100 项目[15404:836338] * 断言失败 -[UIApplication _applicationOpenURLAction:payload:origin:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKitCore_Sim/ UIKit-3698.93.8/UIApplication.m:6851 2019-03-11 11:28:37.682291+1100 Project[15404:836338] *由于未捕获的异常“NSInternalInconsistencyException”而终止应用程序,原因:“应用程序具有 LSSupportsOpeningDocumentsInPlace 键,但没有'不实现 application:openURL:options: on delegate '

我该如何解决这个问题不“实现应用程序:openURL:选项:委托”?

谢谢您的帮助

4

1 回答 1

2

您需要UIApplicationDelegate在 AppDelegate.swift 文件中实现指定的方法。

func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any]) -> Bool {
    // handle the file here

    return true // or false based on whether you were successful or not
}
于 2019-03-11T00:55:28.210 回答