Google Cloud Endpoints linking iOS client issues
google-app-engine, google-cloud-endpoints, ios
Solution
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.
Problem
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: /Users/vrao/Library/Developer/Xcode/DerivedData/Own_It!-ertvnctptaddricdrjyrmgemzgsh/Build/Products/Release-iphoneos/libOwnItApi.a(GTLOwnit_Sources.o) ``` 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.