开发者

something wrong in my program by using GData xmlsupport

I'm new here ,i don't know how to use this...here is my code :

NSString *strParse=@"url";
NSURL *urlParse=[NSURL URLWithString:strParse];
NSString *content=[[NSString alloc] initWithContentsOfURL:urlParse];
NSError *error;
GDataXMLDocument *document=[[GDataXMLDocument alloc] initWithXMLString:content options:0 error:&error];

----------------------xml-----

<?xml version="1.0" encoding="UTF-8"?>
<root>
<head>
<version>20100514103110</version>
</head>
<channels>
<channel>
<id>1</id>
<name>
<![CDATA[]]>
</name>
<uuid>
<![CDATA[21001]]>
</uuid>
<site_url>
<![CDATA[http://]]>
</site_url>
<pics>
<url>
<![CDATA[/21001/cms_images/channel/2010-01/21/channel_51224251664216081527429.png]]>
</url>
<url&开发者_开发技巧gt;
<![CDATA[/21001/cms_images/channel/2010-01/21/channel_82864703356323359638124.png]]>
</url>
<url>
<![CDATA[/21001/cms_images/channel/2008-07/04/channel_67535050807177704592393.swf]]>
</url>
<url>
<![CDATA[]]>
</url>
<url>
<![CDATA[]]>
</url>
</pics>
<linkurls>
<url>
<![CDATA[]]>
</url>
<url>
<![CDATA[]]>
</url>
<url>
<![CDATA[]]>
</url>
</linkurls>
<description>
<![CDATA[]]>
</description>
<provider>
<![CDATA[]]>
</provider>
<attr>3</attr>
<props>
<prop1>
<![CDATA[21001/movie_shell.swf]]>
</prop1>
<prop2>
<![CDATA[]]>
</prop2>
<prop3>
<![CDATA[]]>
</prop3>
<prop4>
<![CDATA[]]>
</prop4>
<prop5>
<![CDATA[]]>
</prop5>
</props>
</channel>
</channels>
</root>

----------error below---------------

 Ld build/Debug-iphonesimulator/newParser.app/newParser normal i386
    cd /Users/apple/Desktop/newParser
    setenv MACOSX_DEPLOYMENT_TARGET 10.5
    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/iPhoneSimulator3.1.sdk -L/Users/apple/Desktop/newParser/build/Debug-iphonesimulator -F/Users/apple/Desktop/newParser/build/Debug-iphonesimulator -filelist /Users/apple/Desktop/newParser/build/newParser.build/Debug-iphonesimulator/newParser.build/Objects-normal/i386/newParser.LinkFileList -mmacosx-version-min=10.5 -lxml2 -framework Foundation -framework UIKit -framework CoreGraphics -o /Users/apple/Desktop/newParser/build/Debug-iphonesimulator/newParser.app/newParser

    Undefined symbols:
      "_kGDataXMLXPathDefaultNamespacePrefix", referenced from:
          _kGDataXMLXPathDefaultNamespacePrefix$non_lazy_ptr in GDataXMLNode.o
         (maybe you meant: _kGDataXMLXPathDefaultNamespacePrefix$non_lazy_ptr)
    ld: symbol(s) not found
    collect2: ld returned 1 exit status


Remove #import "GDataXMLNode.h" from precompiled header (and from .h files included there) and add it only in implementation files where needed.


alternatively, you could just define the symbol. change:

_EXTERN const char* kGDataXMLXPathDefaultNamespacePrefix _INITIALIZE_AS("_def_ns");

to something like:

#define kGDataXMLXPathDefaultNamespacePrefix ("_def_ns");

They're using a bit of preprocessor trickery in the original statement, but as far as i can see, this causes no problems and will allow you to import GDataXMLNode.h in your .pch, which is very handy if you're using it frequently - as i am!

Of course, make sure you test this works ok for you too

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜