Swift. Could not build objective-c module 'Alamofire'

社会主义新天地 提交于 2019-11-28 04:01:54

When this happens, just build the frameworks separately first. In your case:

  • Change the scheme to Alamofire
  • Build (⌘B)
  • Change back to your scheme
  • Run

Go into Developer/Xcode/DerivedData and delete the folder for your framework. (Or just delete DerivedData itself)

If you have a build of you app in a running simulator you'll need to delete the app there.

Then Clean & Build

This always works for me:

  1. Quit Xcode
  2. Delete ~/Library/Developer/Xcode/DerivedData
  3. Change to your framework’s scheme and build ⌘B
  4. Change to your app’s scheme and build ⌘B

Deleting the DerivedData folder and cleaning and building the project solved this issue for me.

Build clean worked for me.

  1. Build clean for Alamo
  2. Build clean for HTTPDemo

If you're getting this error trying to import a dynamic framework, make sure the framework is included in the target's Target Dependencies.

Project > "Target" > Build Phases > Target Dependencies

ravisekahrp

Try the following in this order and one of the steps should work.

  1. Cmd+B - Builds the workspace and should possibly build the target or module we want.

  2. Cmd+K and then Cmd+B - Clean and then Build

  3. Cmd+Shift+Option+K and Cmd+B - Clean Build Folder

  4. Quit Xcode, Delete Derived Data, launch Xcode and Cmd+Shift+Option+K then Cmd+B

This happens to be the cleanest possible way to clean the derived data and other caches from Xcode.

Comment out the import and all code using it, build, run, then uncomment. It worked for me...

I resolved this issue in one of my Objective-C/Swift hybrid projects.

In your Objective-C bridging file, add the following line:

#import <Alamofire/Alamofire.h>

Any pod failed to build may cause this error as well. (in my case an old pod using obsolete syntax failed to build).

You may try pod update to update your pods to latest version and see how thing goes.

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