Undefined symbols for architecture arm64: Undefined symbol : _UTTypeConformsTo in Swift 5

I am working on the ios project. I didn't have any problem at the moment. However, there is a problem with iOS 11.4 version of iPhone 6.



I've already built my project with the iOS 12.4 iPhone 6 device, and there's nothing wrong with it.



This is a problem when you connect a physical device. My error is as follows.



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



I have this function in the `Document.swift` file.



**Document.swift**

~~~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

~~~



problematic environment:



- Xcode: Version 11.0

- Device : IPhone 6 and 11.4 ios version // get Error

- Device : IPhone 6 and 12.4 ios version // This device operates normally.



The two devices are different.



There have been no problems so far, but problems occur when trying to build this device. What's the problem?


##EDIT ###


The error appears to occur when the developer info is set to 11.4. However, 11.4 devices must also be able to be built. What is the fundamental solution?

Answered by DTS Engineer in 384647022

Try adding the CoreServices framework to the Link Binary With Libraries section of the Build Phases tab of the target editor.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
Accepted Answer

Try adding the CoreServices framework to the Link Binary With Libraries section of the Build Phases tab of the target editor.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

I'm sorry, but it hasn't been long since I started iOS. Could you please explain the answer in code so I can understand?

It’s not a code change, but a change to your project:

  1. In the project navigator on the left, select your project. That will show the target editor in the middle.

  2. Select your target on the left of the target editor.

  3. Switch to the Build Phases tab.

  4. Disclose the Link Binaries With Libraries section.

  5. Click the plus (+) button.

  6. Select CoreServices.framework in that list.

  7. Click Add.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
It doesn't work.

its not working

Undefined symbols for architecture arm64: Undefined symbol : _UTTypeConformsTo in Swift 5
 
 
Q