架构 arm64 的未定义符号:未定义符号:_UTTypeConformsTo on Xcode11 Swift 5

Undefined symbols for architecture arm64: Undefined symbol : _UTTypeConformsTo on Xcode11 Swift 5

我正在处理 ios 项目。我目前没有任何问题。但是iOS11.4版本有问题iPhone6.

我已经用 iOS 12.4 iPhone 6 设备构建了我的项目,没有任何问题。

这是连接物理设备时出现的问题。我的错误如下。

Undefined symbols for architecture arm64:
  "_UTTypeConformsTo", referenced from:
      myapp.Document.uti(_: Swift.String, conformsTo: Swift.String) -> Swift.Bool in Document.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Undefined symbol : _UTTypeConformsTo

我在 Document.swift 文件中有这个函数。

Document.swift

class Document: UIDocument {


    var fileData: Data?

    var filesText: Data?

    func uti(_ uti: String, conformsTo candidateParent: String) -> Bool {
        return UTTypeConformsTo(uti as CFString, candidateParent as CFString)
    }
...
    override func load(fromContents contents: Any, ofType typeName: String?) throws {
        if let fileType = typeName {
            if fileType == "public.png" || fileType == "public.jpeg" { // .jpg not recognized
                if let fileContents = contents as? Data {
                    fileData = fileContents
                }
            } else if !uti(typeName!, conformsTo: "public.data") {
                throw IXError.fileAcessFailed
            } else {
                if let fileContents = contents as? Data {
                    filesText = fileContents
                }
                print("File type unsupported.")
            }

        } // end if let fileType = typeName

    } // end func load

有问题的环境:

两个设备不同。

到目前为止没有出现任何问题,但在尝试构建此设备时出现问题。有什么问题吗?

当开发者信息设置为 11.4 时出现错误。但是,还必须能够构建 11.4 设备。根本的解决办法是什么?

请想出很多解决方案。

我能够通过将 CoreServices 框架添加到目标编辑器的创建步骤选项卡的库和连接部分来解决这个问题。这是一个简单的解决方案,但却是一个困难的解决方案。