MyClass is unavailable: cannot find Swift declaration for this class - Release Build Only

If MyClass is inside a dynamic framework (Cocoa Touch Framework), It is likely that you're using a build with wrong architecture. To check, browse your MyClass.framework in finder, and check Modules/AirServiceKit.swiftmodule. There should be something like x86_64.swiftmodule or arm64.swiftmodule, if you're using simulator there should be x86, or arm if you're building for device.


In case anyone else encounter this problem:

I had the exact same error and turned out that I had built my framework for an specific emulator. I changed the device (in upper left corner) to Generic iOS device and did a clean and build, then I used the generated .framework file. Everything worked just fine after using this generated .framework file.


In my case, it was because my framework that I am developing was missing one of the Valid Architectures listed in my app's target. All I had to do was the following:

  1. Go to Project file.
  2. Go to Build Settings for the app target you're trying to build. Note the architectures listed under Valid Architectures.
  3. Go to the framework target that is failing.
  4. Make sure all the architectures match.

In my case, my framework was missing arm64.

Tags:

Xcode

Swift