I'm trying to build a PhoneGap-based application using Xcode 4. Since there's no PhoneGap project template for Xcode 4, I used the handy web page to create the project. However, I'm getting the following error when I build:
Undefined symbols for architecture armv7:
"_OBJC_METACLASS_$_PhoneGapDelegate", referenced from:
_OBJC_METACLASS_$_TestAppDelegate in TestAppDelegate.o
"_OBJC_CLASS_$_PhoneGapDelegate", referenced from:
_OBJC_CLASS_$_TestAppDelegate in TestAppDelegate.o
ld: symbol(s) not found for architecture armv7
collect2: ld returned 1 exit status
The bulk of the Cocoa Touch code for a PhoneGap app is built as a library called PhoneGapLib. The application project references the PhoneGapLib project and depends on and links with its product, PhoneGapLib.a. PhoneGapDelegate is defined in PhoneGapLib; TestAppDelegate is defined in the main project. I've set the Valid Architectures setting for both the main project and the PhoneGapLib project to "armv6 armv7 i386".
I don't know what's causing the error above. Can anyone decipher it and tell me which build settings I should be looking at to resolve it?
I found a Google Groups thread in which the author solves a similar problem by using lipo to manually combine different builds of the library. I'd really like to avoid that step if possible -- this seems like something that I should be able to accomplish with the ri开发者_运维百科ght combination of build settings in the two projects.
Thanks for your help!
0.9.5.1 release includes Xcode 4 templates.
Although I still don't know how to resolve the linker error described above, I was able to work around it by creating a new project using the web page linked above. I also downloaded PhoneGap 0.95, a 0.01 upgrade from my previous version. I don't know which of these two actions fixed the problem, but I'm now able to build a PhoneGap app without the problem above. Also, someone pointed out that there are now some beta PhoneGap templates available for Xcode 4.
精彩评论