【问题标题】:Undefined symbols for architecture arm64: Undefined symbol : _UTTypeConformsTo on Xcode11 Swift 5架构 arm64 的未定义符号:未定义符号:Xcode11 Swift 5 上的 _UTTypeConformsTo
【发布时间】:2019-09-26 14:34:03
【问题描述】:

我正在开发 ios 项目。目前我没有任何问题。但是,iOS 11.4 版本的 iPhone 6 存在问题。

我已经使用 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

有问题的环境:

  • Xcode:11.0 版
  • 设备:iPhone 6 和 11.4 ios 版本 // 出错
  • Device : iPhone 6 and 12.4 ios version //此设备运行正常。

这两种设备是不同的。

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

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

请想出很多解决方案。

【问题讨论】:

    标签: ios swift xcode documentation


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2013-10-13
      • 1970-01-01
      • 2021-08-23
      • 2021-07-25
      • 2018-11-14
      • 2015-12-05
      相关资源
      最近更新 更多