Lastmboy
Lastmboy

Reputation: 1869

"No such module" error when archiving

My Swift 4 app rebuilds and runs successfully on all simulators except for Generic iOS Device. If I try to archive it or do a rebuild on Generic iOS Device, I get a No such module error relating to one of my pod frameworks.

I tried adding the framework to Linked Frameworks and Libraries, and that removed the error, but then it fails on the next pod framework, and so on. I have tried all sorts of paths in Framework Search Paths with no luck.

Currently, the value is set to:

enter image description here

I even tried deleting the workspace, the pod lock file, and the pods folder, and then I did a pod install to rebuild everything. Again, it rebuilds clean on any simulator except the generic one. On the generic one, I get No such module on all import statements for pod frameworks.

Any suggestions appreciated, as this problem has me completely stalled, since I can't get a release out.

Upvotes: 24

Views: 10371

Answers (10)

Ravi Kumar
Ravi Kumar

Reputation: 1366

There is another case similar to the same error. when you have an Embedded Framework project with min iOS 10 (Any iOS Device arm64, arm7) while I am archiving the build of the project with min deployment version iOS 11(Any iOS Device amr64) in Xcode 12.5.1.

I have to change the min deployment version of the Embedded Framework project to iOS 11(Any iOS Device amr64) to match with my project's deployment version.

Upvotes: 1

Peter Wauyo
Peter Wauyo

Reputation: 987

Seems like by opening up the project by double clicking Runner.xcworkspace instead of Runner.xcodeproj, xcode can finally figure out where everything is. Even though you can still debug in an emulator and on a connected phone from the .xcodeproj file...

Seems strange that it would fix it. But I'm happy to have an Archived build now.

Check out this link for more info

Upvotes: 1

MhmdRizk
MhmdRizk

Reputation: 1721

I kept facing the issue "No such module" while archiving the app.

I tried this approved answer and it worked perfectly but, a new warning was appearing in my Podifle.

So I did the below and it worked without any warning.

Podfile :

enter image description here

XCode -> Targets -> My App -> General :

enter image description here

switched iOS from 10.0 to 11.0 and then everything worked perfectly.

Upvotes: 1

toupper
toupper

Reputation: 636

In my case I had selected a Device on Xcode when archiving, choosing Generic iOS Device solved my problem.

Upvotes: 2

Chris Douglass
Chris Douglass

Reputation: 309

In my case, the module which couldn't be found was a dynamic Obj-C framework with a minimum deployment target higher than my application project's minimum deployment target. Bumping my minimum version fixed it, but you could drop the version on the framework instead.

Upvotes: 0

Saeed Ir
Saeed Ir

Reputation: 2332

It's better to check the project settings by going to Build Settings, find Framework Search Paths and add $(SRCROOT) and be sure it's recursive.

Upvotes: 1

spijs
spijs

Reputation: 1529

For me what fixed it was removing one line from my Podfile and rerun pod install.

platform :ios, '11.0'

I think the version of the pods was not aligned with the version of my target, causing this issue.

Upvotes: 33

eharo2
eharo2

Reputation: 2642

I was able to fix the problem editing the ios version line in the Podfile to match the Project target version (10.0 in this case) in Info.

  #Podfile
  platform :ios, '10.0'

enter image description here

Finally I had to run

pod update

After that, I was able to Archive my project selecting Generic iOS Device

Upvotes: 14

Lastmboy
Lastmboy

Reputation: 1869

I was able to get it to archive by re-creating the project from scratch. I created a new project, used the same pod file to install the pod libraries, then copied everything over from the other project. I am now able to archive it and push it to the store. Must have been some corruption or a rogue setting.

Upvotes: 0

Gustavo Freire
Gustavo Freire

Reputation: 105

first build your project command + b and see if the frameworks are in red when you look at then at the right sidebar, if they are, xcode did not find your files on the specified path, if not, building and then archiving should work

Upvotes: 0

Related Questions