16

In My Xcode 12.4 I can't build my projects anymore. Each time I do I get "No such module..." for each Pod. I haven't made any other changes to the project. I've cleaned, deleted Derived Data, restarted my computer, deleted and reinstalled the Pods, updated Cocoapods, added arm64 in excluded Architecture etc.

I can run on my device but not on a simulator

Has anyone else had this issue?

Vijay Parmar
  • 334
  • 1
  • 4
  • 11
  • 2
    Make sure you are opened the `yourproject.xcworkspace` instead of `yourproject.xcodeproj` – Dilan Apr 05 '21 at 03:54
  • Yes, I opened yourproject.xcworkspace – Vijay Parmar Apr 05 '21 at 03:55
  • 1
    I can run same opened project on my device but not on a simulator – Vijay Parmar Apr 05 '21 at 03:56
  • Try this: https://stackoverflow.com/a/63955114/14351818 – aheze Apr 05 '21 at 04:07
  • @aheze as i mentioned in questions I use this setting but now I face this error :-- No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=arm64, VALID_ARCHS=arm64 arm64e i386 x86_64, EXCLUDED_ARCHS=( arm64 )). – Vijay Parmar Apr 05 '21 at 04:16
  • @VijayParmar I ran into something like that before. I literally tried everything. After a couple hours when I came back to my computer, it worked. Maybe try that (taking a break and coming back)? – aheze Apr 05 '21 at 04:18
  • @aheze thanks for help, I face this issue in my every new project in latest Xcode in Apple m1, I don't recognise how to resolve this, in my other project I tried different ways to make project working, but this time I can't able to find proper solution – Vijay Parmar Apr 05 '21 at 04:24
  • @VijayParmar yeah, M1 really is kind of weird when it comes to architectures... – aheze Apr 05 '21 at 04:31
  • You can try the first answer of this ask. [link here](https://stackoverflow.com/questions/65978359/xcode-error-building-for-ios-simulator-but-linking-in-dylib-built-for-ios-f) – Bomi Chen May 11 '21 at 07:02
  • You can try the top answer of this ask. [link here](https://stackoverflow.com/questions/65978359/xcode-error-building-for-ios-simulator-but-linking-in-dylib-built-for-ios-f) – Bomi Chen May 11 '21 at 07:17

3 Answers3

39

Adding this to podfile helps me

post_install do |installer|   
      installer.pods_project.build_configurations.each do |config|
        config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
      end
end
Kirill Yermak
  • 405
  • 5
  • 5
  • 14
    Thanks Kirill! Your fix worked for me. Do you understand why it works? If we are on an arm64 architecture, why should we exclude arm64 simulator architectures? – harrolee Feb 23 '22 at 19:07
3

For me the fix was Kirill's accepted answer, but I also needed to add arm64 for Excluded Architectures in target's Build Settings:

1

stackich
  • 3,607
  • 3
  • 17
  • 41
1

For Mac's with the new M1 chip:

  1. Open Finder -> Applications
  2. Right-click on XCode -> Select Get Info
  3. Select the box for Open with Rosetta
  4. Completely quit XCode and reopen.
Dane B
  • 169
  • 12