Search code examples
iphonexmliadgdata

Using GDataXMLDocument in iPad app


I'm trying to use GDataXML library in my ipad application. I followed by instructions:

  • Download the gdata-objective-c client library.
  • Unzip the file, navigate to Source\XMLSupport, and drag the two files GDataXMLNode.h and GDataXMLNode.m into your project
  • In XCode, click Project\Edit Project Settings and make sure “All Configurations” are checked.
  • Find the Search Paths\Header Search Paths setting and add /usr/include/libxml2 to the list.
  • Finally, find the Linking\Other Linker Flags section and add -lxml2 to the list.

If in code i add #import "GDataXMLNode.h", all is fine. But when i try to use GDataXMLDocument class in my app

GDataXMLDocument *doc = [[GDataXMLDocument alloc] initWithData:xmlData options:0 error:nil];

I received the following message:

Ld build/Debug-iphonesimulator/DemoApp.app/DemoApp normal i386
cd /Users/svp/Projects/DemoApp
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk -L/Users/svp/Projects/DemoApp/build/Debug-iphonesimulator -F/Users/svp/Projects/DemoApp/build/Debug-iphonesimulator -filelist /Users/svp/Projects/DemoApp/build/DemoApp.build/Debug-iphonesimulator/DemoApp.build/Objects-normal/i386/DemoApp.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -framework Foundation -framework UIKit -framework CoreGraphics -framework MapKit -framework QuartzCore -lxml2.2 -o /Users/svp/Projects/DemoApp/build/Debug-iphonesimulator/DemoApp.app/DemoApp

Undefined symbols:
  "_OBJC_CLASS_$_GDataXMLDocument", referenced from:
      objc-class-ref-to-GDataXMLDocument in TwitterService.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

Any thoughts?


Solution

  • Best thing is to leave the source code untouched and tell your project not to apply the ARC mechanism to this file. To do so: 1- Select the build phases of your projet 2- Select the GDataXMLNode.m file 3- Add the switch: -fno-objc-arc to this file alone (by double clicking on it)

    Bingo!

    Hope it helps.