Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 4 Needs i386 for iPhone Sim?

Tags:

xcode

iphone

I upgraded to Xcode 4.

If I make a new iPad project in Xcode 4, everything works. If I make a project in Xcode 3 and then bring it over to Xcode 4, that works too.

One of my projects, however, would not compile. Error was:

No architectures to compile for (ARCHS=i386, VALID_ARCHS=armv7).

To get it to compile and run in the simulator, I ended up using these settings:

freaky but working settings in XCode 4

Putting i386 got the project to compile and run (thanks to this forum thread), but my other projects do not have i386 in the Valid Architectures and still work.

How can I make my project like the others?

Note: Yes, I've gone through the project quite carefully (in XCode, not the XML, though) and the non-compiling version did look exactly like its compiling friends.

like image 296
Dan Rosenstark Avatar asked Mar 30 '11 18:03

Dan Rosenstark


2 Answers

In the developer forums, I ran across people that edited the .pbxproj file with a text editor, and just added the entries into VALID_ARCHS that way. It seems to be a problem when XCode4 is handling some older XCode3 projects (although I've not seen that yet).

I checked a current project and this line does not exist, so if you see this problem try removing it from your project.pbxproj file and then restart XCode.

like image 181
Kendall Helmstetter Gelner Avatar answered Oct 12 '22 23:10

Kendall Helmstetter Gelner


I had precisely the same issue and wrote a little shell script to programmatically edit the lines where I need to add i386 (I do this in my test harness after every git pull and tag checkout).

Place the following code in a shell script and then run it whenever you need to add i386 to all the VALID_ARCHS= entries:

sed -i -e 's/.*VALID_ARCHS = armv7;.*/VALID_ARCHS = "armv7 i386";/g' project.pbxproj

Oh, given the direct simplicity of this script, you need to be in the same directory where the project.pbxproj file is when you run it.

And, as implied, it does a global line replace. It replaces every instance of VALID_ARCHS = armv7; with VALID_ARCHS = "armv7 i386"; and the quotes are necessary or Xcode will throw an error telling you that the project.pbxproj file cannot be parsed.

like image 21
Wulf Avatar answered Oct 12 '22 21:10

Wulf