iPhone JSON Error After Upgrading to Xcode 4 and iOS 4.3
I just updated to Xcode 4 and iOS 4.3 but now when I try to build/run my project, it returns the following JSON SDK error:
ld: warning: ignoring file /var/folders/OV/OVQ5LuaPFY4lW0L0a9jdRk+++TI/-Caches-/com.apple.Xcode.501/开发者_如何学编程CompositeSDKs/iphoneos-iPhoneOS4.3-dqtvoenrseczxwakgamuhnlmhcbu/usr/local/lib/libjson.a, file was built for archive which is not the architecture being linked (armv7)
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_SBJSON", referenced from:
objc-class-ref in Neighbourhoods.o
objc-class-ref in StreetLevel.o
...
ld: symbol(s) not found for architecture armv7
collect2: ld returned 1 exit status
After upgrading to Xcode 4, it now seems to be trying to build for release whereas in the old versions I believe it was building for debug, but I can't seem to see where I can change that.
I've got the JSON SDK installed under ~/Library/SDKs/
The SDK has been added to the Additional SDKs section for both release and debug. I've also made sure that the following 'Other Linker Flags' are also added to both release and debug: "-all_load -ObjC -ljson".
After checking/adding all that, it still won't build.
Anyone able to shed any light on this problem?
I'm not sure why in the end it stopped working after the update, but I have now removed the SDK and just added the source code to the project, not ideal but it works.
I had the same error when building a third-party library, when under 4.2.6 it didn't complain before. Open up the library project, go to the menu "Project --> Edit Project Settings --> Build Tab" and look under "Architecture".
Under the sub-items "Architectures" and "Valid Architectures" check that they contain a reference to "armv7". If not you will have to select/add it.
Do the same for your active target: menu "Project --> Edit Active Target --> Build".
After making the changes, build again, and you should not have linker errors.
I had working project that failed to link after I switch to SDK 4.3 after updating Xcode 4. I removed ARM7 from the target architecture, leaving only ARM6, and that fixed it. A shot in the dark but perhaps others can use this workaround too.
精彩评论