- Checking Out Sources
- Create Project to Test
- Add Source code GData to my Project
- Build Project and Copy Folder Headers
- Linking to the iPhone Static Library
- Removing Unneeded Code
- Config to Product/Archive
Checking Out Source
Check out with link : http://gdata-objectivec-client.googlecode.com/svn/trunk/
Create Project To Test
Copy Source code to my Project on folder:
ex: GData
Add Source Code to Project.
Add a new target dependency:
a. Click your target -> Build Phases -> Target Dependencies -> the + button
b. Choose GDataTouchStaticLib and click Add
b. Build Phases -> Link Binary With Libraries, the + button
add the libGDataTouchStaticLib.a
c. Also add the following frameworks at the same place, they are needed by GData.
- SystemConfiguration.framework
- Security.framework
- libxml2.2.dylib
- libz.1.2.5.dylib
d. In Build Settings, add the following entries under “Other Linker Flags”
e. Also in Build Settings, set /usr/include/libxml2 under “Header Search Paths”
f. Add some settings for Project GData
Select GData.xcodeproj -> Select GDataTouchStaticLib - > Build Settings : type "Other C"
Add to Debug and Release :
-DGDATA_REQUIRE_SERVICE_INCLUDES=1
-DGDATA_INCLUDE_YOUTUBE_SERVICE=1
Build Project and Copy Folder Headers
Build your project (⌘B). When build success.
In your derived data directory, browse to Build/Products/Debug-iphonesimulator
Removing Unneeded Code
However you build the library, it is worthwhile to remove code for the services that your application will not be using. To remove unneeded code, set these compile flags in the project or target build settings of the GData.xcodeproj project file. When compiling the sources directly into your application, set these flags in your project's settings.
The conditional flags in most source files of the library look something like this:
#if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_CONTACTS_SERVICE
So in either the project's settings for compile flags or in your project's config file, set GDATA_REQUIRE_SERVICE_INCLUDES to 1, along with the services you are using. For example,
Other C Flags: -DGDATA_REQUIRE_SERVICE_INCLUDES=1 -DGDATA_INCLUDE_CONTACTS_SERVICE=1
If your project compiles the OAuth 2 classes for authentication, also define the conditional -DGTM_INCLUDE_OAUTH2=1 in Other C Flags.
Do remember to set build settings so they apply to both Debug and Release configurations.
There is a conditional set in the static library target as a reminder to developers to define the needed services. For your project, replace or delete the definition
-DGDATA_INCLUDE_nameServiceHere_SERVICE=1
in the Other C Flags section of the static library target's Release configuration.
Config to Product/Archive
*Note: You can comment some code:
#if !DEBUG
#if GDATA_INCLUDE_nameServiceHere_SERVICE && !GDATA_SUPPRESS_INCLUDE_WARNING
#error The service placeholder compiler flag should be replaced by actual service specifications
#endif
#endif
and
Select GData.xcodeproj -> Select GDataTouchStaticLib - > Build Settings : type "skip" and change to Yes.
No comments:
Post a Comment