xcode framework 目录 + missing required architecture i386

呵呵,那个只是以前添加时的目录,你应该自己从文件里边找到这个,拿我的电脑为例子(中文)
a(系统盘)->开发->平台->iphoneOS.platform->Developer->SDKs->iPhoneOS3.0.sdk->system->

Library->Frameworks


Build Error - missing required architecture i386 in file

up vote 22 down vote favorite
19

I'm getting this error when building my iPhone application:

ld: warning: in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.sdk/System/Library /Frameworks/UIKit.framework/UIKit, missing required architecture i386 in file

It goes the same for all the frameworks in my app. It's very weird since this was not happening earlier.

link | improve this question
 
Did this happen after you installed Snow Leopard and the new iPhone SDK (Xcode 3.2)? –  avocade  Sep 28 '09 at 13:45
2  
My answer fixes the problem. Please check. –  Jordan  Oct 16 '10 at 14:44
 
One other possibility that's not discussed in the answers is that you will get this error if you have added a reference to a non-universal framework (i.e. you added an armv6/armv7 framework and then tried to do a simulator build). This is mainly a concern if you have been building your own custom frameworks. –  aroth May 26 at 23:11

protected by Jeff Atwood Jun 7 '10 at 7:22

This question is protected to prevent "thanks!", "me too!", or spam answers by new users. To answer it, you must have more than 10 reputation.

12 Answers

active oldest votes
up vote 40 down vote

I had this same problem, and the solution turned out to be an easy fix. Backup then open project.pbxproj (located inside your project file bundle) in TextMate or TextEdit and search for the section titled "/* Begin XCBuildConfiguration section */". Look for a key named FRAMEWORK_SEARCH_PATHS and delete it and it's contents (once per build configuration, so I removed it in two places). Here is an example of what I deleted:

FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "\"$(DEVELOPER_DIR)/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.sdk/System/Library/Frameworks\"",); 

My project now build for both the iPhone device and the iPhoneSimulator.

  • Sean Roehnelt
link | improve this answer
Sean Roehnelt40122
 
 
1  
I can verify that this works as described. It seems Xcode can easily get out of touch with its metadata when moving Xcode projs between different computers; in this case with one having 3.0 and Leopard, and the other 3.1 and Snow Leopard installed. FRAMEWORK_SEARCH_PATHS metadata shows as blank in Build Settings while the actual project.pbxproj has stuff in it. –  avocade  Sep 28 '09 at 13:44
 
Agreed FRAMEWORK_SEARCH_PATHS also showed as blank in the build settings for me as well. However, hand-editing the project.pbxproj file as described fixed the problem. –  Alasdair Allan  Oct 5 '09 at 13:59
1  
Thank you very much!!! –  goo  Oct 7 '09 at 6:48
 
Thank you! Was banging my head against the wall trying to figure this out. –  iworkinprogress  Oct 12 '09 at 23:17
3  
This did not work for me. HOWEVER, you lead me to the right place to look. My .pbxproj didn't have the FRAMEWORK_SEARCH_PATHS key, but a key named LIBRARY_SEARCH_PATHS. –  rebellion  Mar 2 '10 at 12:52
show 4 more comments
up vote 13 down vote

What has happened here is that Xcode has mysteriously added a "Framework Search Paths" entry that points to a particular iPhone device SDK. For example, mine was recently set to:

$(DEVELOPER_DIR)/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.2.1.sdk/System/Library/Frameworks 

This leads the compiler to find frameworks of the incorrect architecture. Removing any values under the "Framework Search Paths" key in your target's build settings will resolve the issue.

link | improve this answer
 
up vote 10 down vote

This happens when you add a framework to your project and unintentionally copy the framework into your project directory.

The fix is to check your project directory (where you store your project on disk) for any iphone SDK *.Framework files and delete them.

Project will build fine afterwards.

link | improve this answer
 
+1 This fixed it for me, it seems to be a lot easier (and safer) than modifying the Xcode configuration code. –  antalkerekes  Apr 13 at 14:29
 
I know, right! ;) –  Jordan  Apr 13 at 14:51
up vote 5 down vote

Check that you didn't copy the framework into your project when you added it. If you copied it, it can't find the original paths. To fix this problem. Delete the AVFoundation framework from your frameworks folder in your project, then add it again, but this time, make sure you don't have copy check marked.

This fixed it for me!

link | improve this answer
   
up vote 2 down vote

I just wanted to mention that in XCode if you go to "Edit Project Settings" and find "Search Paths" There is a field for "Framework Search Paths". Updating this should fix the problem, without having to hack the project file!

Cheers!

Jesse

link | improve this answer
   
up vote 2 down vote

"Edit Project Settings" and find "Search Paths" There is a field for "Framework Search Paths". delete all!!

link | improve this answer
   
up vote 1 down vote

Though it is possible that something got deleted, it has been my experience that something gets screwed up in the project file. I have yet to pin down what that "something" is. I've had similar issues when the SDK installation is just fine. There are a couple of options.

First, add all of your files to a new project. This seems to usually work. Kind of a pain, though.

Second, you can right-click project in XCode/Get Info/Build/Library Search Paths. Add new paths similar to /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/usr/lib. Add appropriate versions of that string for each version (2.2.1, etc) and platform (simulator or iPhoneOS). Perform a similar action for Framework Search Paths if frameworks are your problem.

Third, which is more work but more reliable, is to open project.pbxproj from within MyProject.xcodeproj (Textmate is good for this). Look for "/* Begin XCBuildConfiguration section */", then "LIBRARY_SEARCH_PATHS" and "FRAMEWORK_SEARCH_PATHS". Add or modify the paths as appropriate, and save the file.

In any case, a pain in the butt, and I'd sure like to pin-point the cause because I've had this happen a couple of times. Project builds fine, then just up and refuses to do so with what seems to be little reason.

link | improve this answer
 
I'm going to just start a fresh project. Oh wells. –  gabeshahbazian  Sep 23 '09 at 0:59
 
You can fix the "Frameworks Search Paths" build settings from a target's info panel. –  John Cromartie  Sep 23 '09 at 16:48
up vote 0 down vote

Run the file command on the framework from Terminal:

file /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.sdk/System/Library /Frameworks/UIKit.framework/UIKit 

You should get back a message telling you which architectures the UIKit binary is compatible with. If you don't see "i386" listed, then you've somehow managed to remove the i386 version of UIKit, which will mean that you can't build for the simulator.To fix that, you'll have to re-install the SDK.

If you get some other error, hopefully it'll help you figure out what the actual problem is.

link | improve this answer
 
Reinstalled the sdk and I still get the same exact build error. –  gabeshahbazian  Sep 22 '09 at 2:47
 
no need to reinstall the sdk dude –  Radix  May 20 at 12:18
up vote 0 down vote

As mentioned by somebody here, Reinstalling the SDK doesn't help, So I would suggest others not to waste time on that.

link | improve this answer
 
This should be mentioned as a comment not an answer –  Radix  May 20 at 12:19
up vote 0 down vote

I just want to let you know that In my case, I was having the same problem, I realized that I had an older Xcode folder called Xcode3.1.3 I just rename it because it was an older version and that did the magic for me.

link | improve this answer
   
up vote 0 down vote

Check your library search paths in your target settings. Sometimes goofy libraries get entered in there and this will give you a similar error.

You can remove all entries in this section.

link | improve this answer
   
up vote 0 down vote

I too got the same error am using xcode version 4.0.2 so what i did was selected the xcode project file and from their i selected the Target option their i could see the app of my project so i clicked on it and went to the build settings option.

Their in the search option i typed Framework search path, and deleted all the settings and then clicked the build button and that worked for me just fine,

Thanks and Regards

link | improve this answer

你可能感兴趣的:(xcode,delete,search,Build,textmate,frameworks)