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

OpenProcess gives “Sub or Function not defined” error

vba excel-vba

I'm using VBA in Excel and am trying to use the popular ShellAndWait subroutine. Within this sub is a call to OpenProcess, but that is giving me a compile error "Sub or Function not defined." I've

Specifying *stack-trace-depth* in Clojure tests

unit-testing clojure

What is the correct way to set the value of *stack-trace-depth* in Clojure tests?

Appending '0x' before the hex numbers in a string

python parsing

I'm parsing a xml file in which I get basic expressions (like id*10+2). What I am trying to do is to evaluate the expression to actually get the value. To do so, I use the eval() method which works...

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.