28

I cannot build my application anymore since I updated Xcode to the new version (Xcode 5.1). the error message is 'Could not build module 'UIKit''. I have the same problems with my two pods: AFNetworking SDWebImage

Any thought on this?

jscs
  • 63,694
  • 13
  • 151
  • 195
Sancho Sanchez
  • 590
  • 1
  • 6
  • 19
  • Updating to xocde 5.1.1 and clean+build solved my issue. – Vipin Johney May 06 '14 at 06:59
  • Please put the solution you've found into an answer below, rather than into the question. [It's perfectly acceptable to answer your own question](http://meta.stackexchange.com/questions/120215/ended-up-solving-my-own-problem-question-what-to-do-with-the-post?lq=1). – jscs May 31 '14 at 19:29
  • Just a tip: This occurred when I accidentally typed something in `UICollectionView.h`, replacing it physically inside sdk folder with another fresh copy of this header from my friend's sdk solved this. – Adil Soomro Feb 17 '17 at 12:23

15 Answers15

21

I met the similar problem. The only difference is that my error is "Could not build module SpriteKit".

I finally solved the problem by deleting all files inside the ModuleCache folder: /Users/YOUR_USER_NAME/Library/Developer/Xcode/DerivedData/ModuleCache Then I build and met errors to prompt me to clean build. I clean the project and rebuild and everything is fine.

I think the cause is that I once played Xcode 6, and it has new modules which missing some architectures (in my case, it is armv7). These new modules pollute the module cache.

Yingpei Zeng
  • 515
  • 8
  • 10
10

I have the same problem. I solved this by going to XCode -> Preferences ... -> Download

enter image description here

I have iOS 6.1 and 7.0 simulators.

In the project go to Build Settings -> Deployment and then in iOS Deployment Target section make sure the right iOS simulator version is selected. In my case I chose iOS 7.0

enter image description here

channa ly
  • 9,479
  • 14
  • 53
  • 86
  • 1
    this page is the closest search i could find for my error "could not build module 'parse'" and channa ly solution worked. i plugged in my iphone (instead of testing on simulator) and the error auto went away. (thank you channa ly) – tmr Oct 31 '14 at 17:12
10

I solved the issue by deleting and adding UIKit.framework in Build Phases -> Link Binary With Libraries.

Sancho Sanchez
  • 590
  • 1
  • 6
  • 19
7

Go to your DerivedData directory and remove ModuleCache directory.

In terminal:

cd /Users/<account_name>/Library/Developer/Xcode/DerivedData
rm -rf ModuleCache/

then reinstall pods: pod install.

If it doesn't help try removing whole DerivedData directory and reinstall pods.

Nikita Took
  • 3,980
  • 25
  • 33
5

After trying all of the above to no avail, I finally reinstalled XCode which did the trick.

Patrick T Nelson
  • 1,234
  • 12
  • 21
4

So, I also encountered this problem, and discovered the problem was that my Podfile's minimum iOS version was 6.1 while my project's minimum iOS Version was 6.0. Getting these two values aligned resolved the issue.

Tom Jones
  • 69
  • 4
1

My Problem was the app was running in Release mode Changing back to debug...Boom!! starts working

Lithu T.V
  • 19,955
  • 12
  • 56
  • 101
1

After trying everything else, restarting my computer fixed this.

akiraspeirs
  • 2,127
  • 2
  • 21
  • 29
1

In my case it was Could not build module Twitter Kit. In link Binary with libraries some framework reference were showing as red. Deleting and re adding them worked for me.

Venu Gopal Tewari
  • 5,672
  • 42
  • 41
1

I had similar issue and fixed it by deleting Xcode from Applications and reinstalling it again.Worked like charm.

Milan Gupta
  • 1,181
  • 8
  • 21
1

I think I had both a copy of iphone-private-frameworks which collided with the standard headers, so changing the order in the build settings seems to be OK now.

billy
  • 35
  • 1
  • 5
1

I'm using Xcode 8 having similar issue and I tried Xcode reset,deleting derived data none worked finally resolved the issue by deleting and reinstalling Xcode.

datha
  • 359
  • 2
  • 14
0

Issue looks like it has to do with deployment - going through both the project, pod project, and individual pods to make sure all were set the same was the issue. a bit of a necro, but this is the right answer.

caleb
  • 11
  • 3
0

change xcodebuild commnad parameter

-sdk iphoneos

to

-sdk iphonesimulator 
chaojiang
  • 1
  • 3
-1

I was working on xcode 8 beta and project was building on simulator. But when I tried to run on Device. I got the same error

Could not build module 'UIKit"

It is due to UIKit framwork some how get deleted or Typed something inside it. Deleting Xcode and reinstalling it. Error got solved.

Anil Gupta
  • 1,155
  • 1
  • 19
  • 26
  • Just a tip: This occurred when I accidentally typed something in `UICollectionView.h`, replacing the particular file physically inside sdk folder with another fresh copy of this header from my friend's sdk solved this. You could also replace the entire sdk folder. This will save you from re-installing. – Adil Soomro Feb 17 '17 at 12:26