How to add Gdata in iphone project for release.

56 views
Skip to first unread message

narinder bansal

unread,
Sep 7, 2009, 1:13:18 PM9/7/09
to Google Data APIs Objective-C Client Library Discussion
Hi

I need to know how to package Gdata source in iphone app for release.
In documentation it is mentioned that we should add Gdata source as
reference.

Greg Robbins

unread,
Sep 7, 2009, 1:54:33 PM9/7/09
to gdata-objec...@googlegroups.com
The "traditional" method of building an iPhone app with the library is to just drag the "GData Sources" source group from the GData project window into the iPhone app window. This compiles the GData code directly into the application. Source groups for unneeded services (Analytics, Blogger, etc) and optional code (ACL, Service Introspection, etc) can then be deleted from your project.


There are two recent improvements on the top-of-trunk sources in how to build the library. You need to check out the sources with svn to get the top-of-trunk changes; the project's Source/Checkout page shows how to check out the sources.


You can set defines in the project to exclude all of the unneeded service code. For example, to compile in just the Contacts service, the project defines (put into "Other C Flags") would be

  -DGDATA_REQUIRE_SERVICE_INCLUDES=1 -DGDATA_INCLUDE_CONTACTS_SERVICE=1


The library project file also now includes a target for building a static library for iPhone and iPod Touch apps; this avoids dragging individual library source files into the iPhone app project.

To build with the static library, drag the GData project file itself into an iPhone project (a cross-project reference, as discussed in the Xcode documentation), add the GDataTouchStaticLib target as a dependency for building the app, and add the -ObjC link option to the app. Also add the above defines to the GData project so that it won't compile unneeded services.

Compiler conditionals: http://groups.google.com/group/gdata-objectivec-client/browse_thread/thread/e94e6b7e05239289
Static library builds: http://groups.google.com/group/gdata-objectivec-client/browse_thread/thread/fcc685e419db782d

rivertiger

unread,
Sep 11, 2009, 1:12:14 AM9/11/09
to Google Data APIs Objective-C Client Library Discussion
I'm trying the build with static library method...to clarify:

I'm getting my project info > look up the "Other Linker Flags" field >
enter the value of "-ObjC", correct?

Also, for adding the GDataTouchStaticLib target...once I add the
target, am I suppose to compile only that? even when i do that, I
still get a compile error when adding a header from Gdata, e.g.
"GDataCalendar.h" that the project doesn't recognize it. Can you be
more explicit from A-to-B on the GDataTouchStaticLib adding as target?

Thanks, James
> Compiler conditionals:http://groups.google.com/group/gdata-objectivec-client/browse_thread/...
> Static library builds:http://groups.google.com/group/gdata-objectivec-client/browse_thread/...

Greg Robbins

unread,
Sep 11, 2009, 2:30:58 AM9/11/09
to gdata-objec...@googlegroups.com
There is a new wiki page on building the library that should answer your questions:

http://code.google.com/p/gdata-objectivec-client/wiki/BuildingTheLibrary

Peter J. MASON

unread,
Oct 24, 2009, 9:24:48 PM10/24/09
to gdata-objec...@googlegroups.com

I’m arranging use of static lib. I’ve added the GData.xcodeproj file to my project and have added the static lib as a dependency. When I build my project, there is a definite firs bunch of compiles which I think is the Gdata lib being built, but when it comes time for my files the GData header files aren’t around. The wiki says...

The static library build creates a directory of header files that should be dragged into your application project. With the static library linked into your project, refer directly to the headers by omitting the framework name, like

#import "GDataCalendar.h"

But where is the new directory of header files that must be dragged into my project, for headers to be found? But wouldn’t one expect xcode to be smart enough to make these available anyway, since we’ve already declared a dependency? And why is the static lib built creating header files anyway? Aren’t they part of the GData source code already?

Tom Saxton

unread,
Oct 25, 2009, 11:49:33 AM10/25/09
to gdata-objec...@googlegroups.com
I just did this last night...

The headers folder is in the build directory for the static lib. Adding the
Gdata project does not make its source or header files available to the host
app, which is why you need to add the Header folder, just like adding a
framework.

Tom
--
Tom Saxton
tom...@mac.com


Peter J. MASON

unread,
Oct 25, 2009, 8:46:07 PM10/25/09
to gdata-objec...@googlegroups.com
Thanks for that Tom. One has to copy over the correct
simulator/device/debug/release/... files of course, but it's not that bad as
it happens. I also recommend this article to help fill the gaps ...
http://www.clintharris.net/2009/iphone-app-shared-libraries/


> -----Original Message-----
> From: gdata-objec...@googlegroups.com [mailto:gdata-
> objectiv...@googlegroups.com] On Behalf Of Tom Saxton
> Sent: Monday, 26 October 2009 2:50 AM
> To: gdata-objec...@googlegroups.com
> Subject: Re: How to add Gdata in iphone project for release.
>
>

peter mason

unread,
Oct 26, 2009, 1:50:33 AM10/26/09
to gdata-objec...@googlegroups.com
Tom, Greg I have a new problem, but it's very weird .. an XCode thing, I think ..
I've setup everything to link with the static lib. Lib gets built, according to INCLUDE macros - I'm interested in health service. I don't believe it even tries to build one of the modules. Some of the *.o's have no symbols of course, but when linking I finally get ...

Ld /Users/petem/dev/xcode_build_output/Debug-iphonesimulator/iMediMinder.app/iMediMinder normal i386
    cd /Users/petem/Projects/Medications
    setenv MACOSX_DEPLOYMENT_TARGET 10.5
    setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.2.sdk -L/Users/petem/dev/xcode_build_output/Debug-iphonesimulator -L/Users/petem/Projects/Medications/../../Desktop/PinchAnalytics-r64 -F/Users/petem/dev/xcode_build_output/Debug-iphonesimulator -filelist /Users/petem/dev/xcode_build_output/Medications.build/Debug-iphonesimulator/iMediMinder.build/Objects-normal/i386/iMediMinder.LinkFileList -mmacosx-version-min=10.5 -ObjC -lxml2 /Users/petem/dev/xcode_build_output/Debug-iphonesimulator/libGDataTouchStaticLib.a -framework Foundation -framework UIKit -framework CoreGraphics -framework SystemConfiguration -lsqlite3 -framework CoreLocation -framework CoreData -lPMAnalytics-r64 -o /Users/petem/dev/xcode_build_output/Debug-iphonesimulator/iMediMinder.app/iMediMinder
Undefined symbols:
  ".objc_class_name_GDataEntryHealthRegister", referenced from:
      literal-pointer@__OBJC@__cls_refs@GDataEntryHealthRegister in Service.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

When I look in the static lib I don;t even see that module compiled and in the lib, viz

petem2:Debug-iphonesimulator petem$ ar tv libGDataTouchStaticLib.a | grep Health
rw-r--r--     501/20        10104 Oct 26 11:27 2009 GDataHealthConstants.o
rw-r--r--     501/20        19488 Oct 26 11:27 2009 GDataEntryHealthProfile.o
rw-r--r--     501/20         9928 Oct 26 11:27 2009 GDataFeedHealthProfile.o
rw-r--r--     501/20         9936 Oct 26 11:27 2009 GDataFeedHealthRegister.o
rw-r--r--     501/20        19216 Oct 26 11:27 2009 GDataHealthElements.o
rw-r--r--     501/20        14976 Oct 26 11:27 2009 GDataQueryGoogleHealth.o
rw-r--r--     501/20        14448 Oct 26 11:27 2009 GDataServiceGoogleHealth.o
petem2:Debug-iphonesimulator petem$ 

Yet GDataEntryHealthRegister.[hm] are in my project's Groups and Files pane as part of the project, and they are non trivial. That is where missing sym should come from  ...

petem2:Health petem$ ls -lLtr GDataEntryHealthRegister.[hm]
-rw-r--r--  1 petem  staff  1119  8 Aug 10:11 GDataEntryHealthRegister.h
-rw-r--r--@ 1 petem  staff  2353 26 Oct 11:55 GDataEntryHealthRegister.m

When I look at "svn log" there as some name change issue in August. Could that be part of the problem?
How do I tell what the modules the project REALLY thinks are it needs?
Or is other help possible please?

petem

unread,
Oct 26, 2009, 2:53:18 AM10/26/09
to Google Data APIs Objective-C Client Library Discussion
OK, problem fixed, but WAS and XCode thing. I did "Get Info">Targets
in the GDataEntryHealthRegister.m module, and was surprised to see
that it wasn't a member of the static lib target! Ticked the box,
rebuilt and all is well now.
> >    Tom- Hide quoted text -
>
> - Show quoted text -

Greg Robbins

unread,
Oct 26, 2009, 5:15:45 PM10/26/09
to gdata-objec...@googlegroups.com
Thanks for pointing out the targeting problem with GDataEntryHealthRegister.m, Peter. I'll fix that in the project on the main repository.

Tom Saxton

unread,
Oct 27, 2009, 12:05:43 AM10/27/09
to gdata-objec...@googlegroups.com
Peter - thanks for the link to the article, that does fill in some details
and documents a step I had to discover by experiment: in addition to the
steps listed in the "Linking to the iPhone Static Library" section of the
"Adding the Google Data APIs to a Project" document, you also need to drag
the static library target from under the GData Xcode project down into the
host target's "Link Binary With Libraries" folder so that it actually gets
linked in.

--
Tom Saxton
tom...@mac.com

Peter J. MASON

unread,
Oct 27, 2009, 12:51:03 AM10/27/09
to gdata-objec...@googlegroups.com
Life should be easier shouldn't it.

The other thing trickie for an XCode newbie was where to find the
GDATA_INCLUDE_nameServiceHere_SERVICE definition. Ans: "Get Info">Build on
the lib target. Yet another place for project settings.

Happy to be learning anyway.

> -----Original Message-----
> From: gdata-objec...@googlegroups.com [mailto:gdata-
> objectiv...@googlegroups.com] On Behalf Of Tom Saxton
> Sent: Tuesday, 27 October 2009 3:06 PM
> To: gdata-objec...@googlegroups.com
> Subject: Re: How to add Gdata in iphone project for release.
>
>

Greg Robbins

unread,
Oct 27, 2009, 1:58:38 AM10/27/09
to gdata-objec...@googlegroups.com
Thank you for all these insights. When I update the docs after the next release, I will try to incorporate this advice to make it easier for future developers.

an0

unread,
Oct 30, 2009, 6:41:36 AM10/30/09
to Google Data APIs Objective-C Client Library Discussion
Tom, thanks a lot!
The missing of "Link Binary With Libraries" tortured me for hours.
Googler, improve the doc, please!

Thomas Van Lenten

unread,
Oct 30, 2009, 7:50:43 AM10/30/09
to gdata-objec...@googlegroups.com
On Fri, Oct 30, 2009 at 6:41 AM, an0 <an0...@gmail.com> wrote:

Tom, thanks a lot!
The missing of "Link Binary With Libraries" tortured me for hours.
Googler, improve the doc, please!

Um, at some point folks need to also read Apple's documentation.  There isn't much point in Greg trying to duplicate all of Apple's docs and keep them up to date as Xcode changes.

TVL
Reply all
Reply to author
Forward
0 new messages