views:

642

answers:

5

Hi

somehow I managed to screw up my XCode project settings when compiling for the iPhone. It fails when linking saying that

ld: warning: in /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/AddressBook.framework/AddressBook, file is not of required architecture ... (same for the other frameworks).

So the problem is it is trying to use the simulator framework when compiling for the iPhone.

When you look at the actual link command:

setenv IPHONEOS_DEPLOYMENT_TARGET 3.1 setenv MACOSX_DEPLOYMENT_TARGET 10.5 setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 -arch armv6 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.sdk -L/Users/ben/development/xcode_output/Debug-iphoneos -F/Users/ben/development/xcode_output/Debug-iphoneos -F/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/ System/Library/Frameworks -F/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.sdk/ System/Library/Frameworks

you can see that both the simulator framework and the iPhone framework path is provided. How can I change that? I haven't found it anywhere in the settings.

The [FRAMEWORK_SEARCH_PATHS, -F] in the project settings is empty.

Maybe the problem is with linking in a static library. The project settings for that static library contains a lot of duplicate settings. There are always two identical settings (e.g. two Search Path blocks, two GCC-4.2 code generation blocks etc.) That doesn't look normal.

Regards

A: 

The only way I managed to solve this problem was by creating a new project and starting again :-(

Ben
A: 

ld: warning: in /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/AddressBook.framework/AddressBook, file is not of required architecture ... (same for the other frameworks).

Your building for device right? Not simulator? Find the same framework, but under device. Check the whole file path when you import.

JoePasq
A: 

Check your target's Framework Search Paths. If there's an explicit path in there to the Simulator SDK, remove it.

cdespinosa
Remember, the Target settings, not the Project settings.
cdespinosa
A: 

I think the problem was that the static library I've linked in had two targets for the iPhone and for the simulator. I've changed that so that there is only one target and that seemed to have solved the problem.

Regards

Ben

Ben
A: 

I found when I added a framework to my project the "old way" by navigating to /Developer/platforms/.../Frameworks, it added the full path to the framework path search list in my target settings. This meant that all my frameworks were suddenly borked. Make sure that there is no full path in the search list and you should be able to fix your project without having to make a new one.

[Edit] And on further examination, I see this question was already answered by cdespinoza :)

Adam