Google Cloud Endpoints linking iOS client issues

This problem arises from the fact I don't completely understand static libraries in iOS and the docs from google seem to be a little sparse.

I am trying to use Google Cloud Endpoints for my mobile backend.

I generate the .m and .h files for my client library. Then I created a new project(OwnItApi), dragged the libGTLTouchStaticLib.a static library from GTL.proj to this new project. Then I add the generated files .m and .h files to this project. I add all the .m files to the Compile Sources and then I the header files Copy Files. In the Build Settings I add "-ObjC -all_load" to the Other Linker Flags item.

Update: I forgot to mention that I also copied the headers from the GTL.proj to OwnItAPI project. These include files GTLBase64.h, GTLBatchQuery.h, GTLBatchResult,h, etc. I think I had to do this because the build was failing without them.

Without the headers, I get: the error "'GTLObject.h'file not found." on the import statement.

Then I take the static library generated from this project and add it to my main project whose target is an iphone app. To test if the API is working, I added this to App Delegate

#import "OwnItApi/GTLServiceOwnit.h"
#import "OwnItApi/GTLQueryOwnit.h"
#import "OwnItApi/GTLOwnitApiBrands.h"

This is inside the application:didFinishLaunchingWithOptions: function

static GTLServiceOwnit *service = nil;
if (!service) {
    service = [[GTLServiceOwnit alloc] init];
    service.retryEnabled = YES;
    [GTMHTTPFetcher setLoggingEnabled:YES];

GTLQueryOwnit *query = [GTLQueryOwnit queryForBrandsListWithUserID:@"venkat"];
[service executeQuery:query completionHandler:^(GTLServiceTicket *ticket,    GTLOwnitApiBrands *object, NSError *error) {
    NSArray *items = [object brands];;
    NSLog(@"%@", items);

When I compile I get duplicate errors like this:

duplicate symbol _OBJC_METACLASS_$_GTLOwnitApiBrand in:

17 errors that look just like that. and then finally

clang: error: linker command failed with exit code 1 (use -v to see invocation)

Update: In GTL project, libGTLTouchStaticLib.a is red after I build it and when I right click it the "Show in Finder" is greyed out. To find the .a file I use "Show in Finder" for "GTL.framework" and then go back a folder to find libGTLTouchStaticLib.a.


I believe you're seeing the issue you see because you're also including the GTLOwnit_Sources.m file. You can omit this from the list of files you include.

Need Your Help

How to implement a singleton .NET component, for use by multiple processes?

.net multithreading interop singleton multiprocessing

I would like to implement a component in .NET, and consume it in COM-aware clients via COM interop.

Dynamically create divs Side by Side

javascript jquery html css

I have seen so many posts pertaining the titled issue, but non of them worked in my case.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.