“No such module” error when archiving

别说谁变了你拦得住时间么 提交于 2021-02-07 11:40:13

问题


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:

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.


回答1:


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.




回答2:


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'

Finally I had to run

pod update

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




回答3:


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




回答4:


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.




回答5:


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.




回答6:


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.




回答7:


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




回答8:


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 :

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

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



来源:https://stackoverflow.com/questions/48695303/no-such-module-error-when-archiving

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!