Yesterday I decided to play around with Google Analytics and get familiar with their API. I wanted to create an iPhone app that loads data from Google Analytics and draws graphs for some of the metrics I considered important. But mainly this was to be just a learning project.
I looked around to see if there’s anything out there to handle all the server communication since it’s based on OAuth2 and I didn’t want to implement everything from the ground up and I found this: Google APIs Client Library for Objective-C
Aside from the documentation being sparse, at best, there was no example for the Analytics part either. I’ve copied the Analytics files and the required dependencies into my project everything seemed to go smooth… except that it didn’t.
When trying to compile I’d get a nice linker error saying that there are 97 duplicate symbols (see below). Now, debugging linker errors is about as much fun as trying to count grains of sand while wearing boxing gloves. I checked that the .m files are not included twice under Build Phases -> Compile Sources. Nope, all seemed ok. I even removed the files and added them manually…. No luck. I cleaned and rebuilt… Still nothing. Talk about finding the needle in the hay stack… I ended up looking through the source code and I rested my eyes on this little gem called GTLAnalytics_Sources.m
Arghhhhhhhhhh! Importing .m files? Whyyyyyy? I simply left out the file and all works without a hitch. But I did waste one hour to track this down.
Continue reading →