Saturday, September 24, 2011

Undefined symbol "_OBJC_CLASS_$_GTMOAuth2ViewControllerTouch"

Google's developer documentation for GData Client for iPhone/ObjC seems outdated - I followed the instructions to build the static lib to the letter (Well.. I trust google!) and was stuck for a good few hours with the below error with OAuth classes missing from the static lib while doing release build:


Undefined symbols for architecture armv6:
  "_OBJC_CLASS_$_GTMOAuth2ViewControllerTouch", referenced from:
      objc-class-ref in xxx.o
ld: symbol(s) not found for architecture armv6
collect2: ld returned 1 exit status


Turns out the the "-DGDATA_INCLUDE_OAUTH2=1" C Flag  specified in the Removing Unneeded code section of the instruction is incorrect. It should be "-DGTM_INCLUDE_OAUTH2=1" for the OAuth classes to be linked correctly because thats what is coded inside the OAuth classes! Looks like someone updated the code but forgot to update the documentation.

I have logged an issue - hopefully someone will update the documentation so others don't run into the same issue.
(PS: Hey google, I need me lost hours back!)