My way towards Xcode 4 phonegap integration

283 views
Skip to first unread message

Jakob Sachse

unread,
Mar 30, 2011, 5:00:14 AM3/30/11
to phonegap
Hi,

since I had quite a hard time getting phonegap running in Xcode4 I
wanted to drop
a note here. Perhaps it can help someone.

First of all i got a copy of phonegap from the website. Extracted it
and installed the iOS
package which puts the PhoneGapLib-Project into /Users/<NAME>/
Documents/

Since no Xcode4 template is yet included in the install, I used the
create_project shell script
from Shazron. ( download here:
http://blogs.nitobi.com/shazron/2011/03/16/creating-a-phonegap-project-from-the-command-line-for-xcode-4/
)

Once I had my created project I started the .xcodeproj file. Xcode
opened and I noticed that some files are
missing, (VERSION, phonegaplib project link).

I further noticed that in the source-trees view $(PHONEGAPLIB) wasn't
defined. I added this variable and made it
point to the PhoneGapLib-Project.

I also dragged the missing VERSION and .xcodeproj from Finder into my
Project. Still the build fails with a.

I looked up the Readme where it says, that i386 needs to be added to
VALID_ARCH in the PhoneGapLib-Project.

I compiled the PhoneGapLib-Project which worked fine. But compiling my
PhoneGap Project still failed.
The error still where suggesting that the Lib-Project wasn't compiled
for i386:

-------
Undefined symbols for architecture i386:
"_OBJC_METACLASS_$_PhoneGapDelegate", referenced from:
_OBJC_METACLASS_$_PhoneGapUnifyAppDelegate in
PhoneGapUnifyAppDelegate.o
-------

I switch to the terminal to check the library file by running:
------
mac:Debug-iphoneos Jakob$ lipo -info libPhoneGapLib.a
Architectures in the fat file: libPhoneGapLib.a are: armv6 armv7
------

At the first thought my thinking was confirmed. i386 wasn't supported
from that lib. But then it came to me, that
Xcode puts the iphonesimulator lib into another directory. so I did:
------
mac:Debug-iphoneos Jakob$ lipo -info ../Debug-iphonesimulator/
libPhoneGapLib.a
input file ../Debug-iphonesimulator/libPhoneGapLib.a is not a fat file
Non-fat file: ../Debug-iphonesimulator/libPhoneGapLib.a is
architecture: i386
------

So I basicly had what I wanted but in two different files. I am sure
that problem can be solved
my configuring XCode properly. But I am new to Xcode and my solution
was to combine both files into one
by running:
-------
lipo libPhoneGapLib.a ../Debug-iphonesimulator/libPhoneGapLib.a -
create -output fatlibPhoneGapLib.a
-------

Back in Xcode I added the fatlibPhoneGapLib.a as a static lib and the
magic happened, it compiled and run.

Sean

unread,
Mar 31, 2011, 4:59:02 PM3/31/11
to phonegap
Thanks, Jakob for putting this together. I am able to follow all the
way to here with great success:


> I switch to the terminal to check the library file by running:
> ------
> mac:Debug-iphoneos Jakob$ lipo -info libPhoneGapLib.a
> Architectures in the fat file: libPhoneGapLib.a are: armv6 armv7
> ------
>

I am running phonegap 0.9.4 and libPhoneGapLib.a seems to be missing.


> At the first thought my thinking was confirmed. i386 wasn't supported
> from that lib. But then it came to me, that
> Xcode puts the iphonesimulator lib into another directory. so I did:


Can you share what the complete paths are to these files in your
installation? Maybe I do have these and I just am not looking in the
right place.

> ------
> mac:Debug-iphoneos Jakob$ lipo -info ../Debug-iphonesimulator/
> libPhoneGapLib.a
> input file ../Debug-iphonesimulator/libPhoneGapLib.a is not a fat file
> Non-fat file: ../Debug-iphonesimulator/libPhoneGapLib.a is
> architecture: i386
> ------
>
> So I basicly had what I wanted but in two different files. I am sure
> that problem can be solved
> my configuring XCode properly. But I am new to Xcode and my solution
> was to combine both files into one
> by running:
> -------
> lipo libPhoneGapLib.a ../Debug-iphonesimulator/libPhoneGapLib.a -
> create -output fatlibPhoneGapLib.a
> -------
>

Creative solution, to be sure! :)
Reply all
Reply to author
Forward
0 new messages