1

I'm building an app on an M1 Mac. I added a pod, Swift Package, or framework, attempted to use an object from it, and when I built my project, received this error. I've tried a number of things including changing build settings and deleting the derived data folder. The problem persists no matter what I try

froggomad
  • 1,747
  • 2
  • 17
  • 40

2 Answers2

1

This error seems to occur when a pod or framework isn't ready for the M1 processor yet. Resolving the error varies depending on if it's a pod or framework/Swift Package. Once you remove the offending package/framework/pod, it may be worth trying again if you really need it, sometimes the bug is intermittent.

Either Method (do this first!)

Sometimes this error is resolved without removing a pod or framework.

  1. Clear your Derived Data folder
  2. Clean the build folder with shift+cmd+k

Cocoapods

It seems to be necessary to deintegrate pods, remove the Podfile.lock, take the offending pod out of your Podfile, and reinstall pods.

From Terminal:

pod deintegrate
rm Podfile.lock
nano Podfile

nano can be replaced with your text editor of choice. You just need to remove the offending Pod

pod install

Framework/Swift Package

  1. Click on your project file in Xcode (the blue icon)
  2. With the target selected that contains the framework, click on General
  3. Scroll down to Frameworks, Libraries, and Embedded Content
  4. Click on the offending Framework
  5. Click on the minus icon at the bottom of the list
  6. Click Delete in the confirmation dialogue

Finish Up

No matter the method you choose, it's a good idea to:

  1. Clear your Derived Data folder
  2. Clean the build folder with shift+cmd+k
  3. Reach out to the framework/pod author and ask them to update it for M1 support
  4. File a bug report with Apple
froggomad
  • 1,747
  • 2
  • 17
  • 40
1

I am using Firebase with Swift packages (and I have the m1), and this resolved the issue for me:

File -> Swift Packages -> Reset Package Caches

I did this after a hard restart and cleaning the build folder. All good now.

Alan Scarpa
  • 3,352
  • 4
  • 26
  • 48
  • This normally fixes the problem and derived data only needs to be cleared sometimes, so I'm making this the accepted answer – froggomad Aug 02 '21 at 15:21