Search code examples
iosswiftxcode12

Undefined symbols for architecture arm64: Xcode 12


Im trying to build a project after adding 3rd party framework, however I can't compile the project after adding the framework, I get Undefined symbols for architecture arm64: error when I try to compile on a device, but I can compile on a simulator. I have tried all other solutions I found on stackoverflow. any help is appreciated!

Here is what I have tried:

  • Added Any iOS Simulator SDK with value arm64 inside Excluded Architecture.
  • I do have $(inherited) inside Other Linker Flags
  • Set Bitcode Enabled to No

None of the solutions I tried worked for me.

Undefined symbols for architecture arm64:
      "_OBJC_CLASS_$_*", referenced from:
          objc-class-ref in frameworkName.o
    ld: symbol(s) not found for architecture arm64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

Solution

  • I found the issue.

    My project supports lower minimum deployment target than the framework, and that caused the issue. I had to include the framework starting from a specific iOS version.

    Here is the scenario and the issue: my project supports iOS 9 and the framework supports starting from 9.1. For that reason I was not getting the latest framework, instead Cocoapods was downloading the older version of the framework which doesn't support arm64.

    So for the time being I just included the framework only for iOS 9.1 and above:

    platform :ios, '9.1'
          pod 'PodName', '~> 3.2'
    

    Then the project compiled properly, thanks for those who tried to help. I spent half day because of this and Im putting this here for anyone who might face the same problem.