• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
A Return NSString Problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

A Return NSString Problem


  • Subject: A Return NSString Problem
  • From: Bing Li <email@hidden>
  • Date: Mon, 30 May 2011 11:19:50 +0800

Dear all,

I got a problem when processing NSString returned from a method, which
extracting data from an XML. The data is extracted correctly by the
following method.

However, when executing "isEqualToString" with the returned NSString, it got
the exception as follows.

"-[NSXMLNode isEqualToString:]: unrecognized selector sent to instance
0x1001233e0"

If tracking with XCode, the NSString variable which holds the returned value
from the following method is specified as "Variable is not a CFString". How
to fix the bug?

+ (NSString *) Read:(NSString *)xml Path:(NSString *)xPath
{
        NSError *err = nil;
        NSXMLDocument *xmlDoc = [[NSXMLDocument alloc] initWithXMLString:xml
options:NSXMLDocumentTidyXML error:&err];
        NSArray *nodes = [xmlDoc nodesForXPath:xPath error:&err];
        [xmlDoc release];
        [err release];
        if ([nodes count] > 0)
        {
                return [[nodes objectAtIndex:0] autorelease];
        }
        else
        {
                return Constants.WWW.EMPTY_STRING;
        }
}

Thanks so much!
Bing
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: A Return NSString Problem
      • From: Chris Hanson <email@hidden>
    • Re: A Return NSString Problem
      • From: Ken Thomases <email@hidden>
    • Re: A Return NSString Problem
      • From: Graham Cox <email@hidden>
  • Prev by Date: Re: Cocoa-preferred licensing key style?
  • Next by Date: Re: A Return NSString Problem
  • Previous by thread: Re: Cocoa-preferred licensing key style?
  • Next by thread: Re: A Return NSString Problem
  • Index(es):
    • Date
    • Thread