Life is a program you write everyday ~
GData Objective-C Client Setup in XCode 4
My previous post suggested a simple way for deploying GData Objective-C client in Xcode 4, with a trade-off of using big static library image file (19MB).
By following the official compiling procedures, you may specify which API(s) to compile, and target for specific architecture (device or simulator). Thus the output image file will be significantly smaller (~3MB). However, its not easy to follow by just reading the text description in Google Code. So I prepared a step-by-step tutorial for its setup procedures, hope it helps
- Download the GData sources and drag the GData.xcodeproj from Finder into your project source tree.
- Add a new target dependency: Click your target -> Build Phases -> Target Dependencies -> the + button
- Choose GDataTouchStaticLib and click Add
- In your project target -> Build Phases -> Link Binary With Libraries, add the libGDataTouchStaticLib.a library under the Workspace folder. Its in red after adding, because it will be the build output of the previous step, that is not existed yet.
- Also add the following frameworks at the same place, they are needed by GData.
- In Build Settings, add the following entries under “Other Linker Flags”
- Also in Build Settings, set /usr/include/libxml2 under “Header Search Paths”
- Remove unnecessary APIs:
For instance, if I want Calendar API only, select the GDataTouchStaticLib target of your GData project cross reference. Add the following 2 entries in “Other C Flags” for both Debug and Release settings:
- Note that -DGDATA_REQUIRE_SERVICE_INCLUDES=1 is compulsory (and already added in Release settings), while the others depend on what APIs you want. Say if you want Contacts API, you got to add
and so on..
- Build your project (⌘B), get your build product by opening Organizer -> Projects,then show your derived data in Finder by clicking the little arrow.
- In your derived data directory, browse to Build/Products/Debug-iphonesimulator, then drag the Headers directory to your source tree. (just link the header files is fine, thanks Fistman for correction)
- Thats all! To use the GData classes, just import the following header file and start coding ~
Hope this tutorial helps, happy coding :)