1

我正在尝试在我的 ipad 应用程序中使用 GDataXML 库。我按照说明进行操作:

  • 下载 gdata-objective-c 客户端库。
  • 解压缩文件,导航到 Source\XMLSupport,然后将两个文件 GDataXMLNode.h 和 GDataXMLNode.m 拖到您的项目中
  • 在 XCode 中,单击 Project\Edit Project Settings 并确保选中“All Configurations”。
  • 找到 Search Paths\Header Search Paths 设置并将 /usr/include/libxml2 添加到列表中。
  • 最后,找到 Linking\Other Linker Flags 部分并将 -lxml2 添加到列表中。

如果我在代码中添加#import“GDataXMLNode.h”,一切都很好。但是当我尝试在我的应用程序中使用 GDataXMLDocument 类时

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

我收到以下消息:

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

有什么想法吗?

4

3 回答 3

3

It sounds like the GDataXMLNode.m code isn't being linked in. Is that source file really added to the target being built in Xcode?

于 2010-12-28T01:50:27.147 回答
1

检查以下内容:

  • 您是否将文件复制到项目中或只是传递了文件的引用。
  • If you have not copied the file into your project (just passed the reference to it by drag drop or other ways), make sure that the path in "Header search Paths" is properly updated.

Its seems like you have missed to update the path from where you are referencing the file.

于 2010-12-27T12:49:11.593 回答
1

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.

于 2013-05-07T02:48:36.517 回答