Solved: Xcode archive errors with "Undefined symbols for architecture arm64" when internal framework

1.6k views Asked by At

Posting some learnings after much searching for:

  • Xcode app deploys fine in debug mode to iOS device, but archive fails with: symbol(s) not found for architecture arm64
  • Archiving an app with an internal framework
  • Using Swift in a framework with Objective-C

The situation: I was refactoring an iOS app and added an audio unit target. To share the main parts of the app I created a private framework. The refactor went well and the app deployed to the devices just fine. But archiving was failing, it seemed Xcode was stripping symbols out.

The "arm64" is a bit misleading. It's also not a strip on copy problem (see this post on a static library). Changing any of the settings did not work, e.g. removing symbols in the "Copy Phase Strip", "Remove Swift symbols". Builds would fail with the linking error:

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

There are 1 answers

0
Amy On

Solution: add public to framework classes you want to expose to Obj-C.

It turns out release mode is stricter. Add public to framework classes and methods you want to expose to Objective-C. Also found a raywenderlich.com article, "Creating a Framework for iOS", that explains things.