• 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
Re: A Return NSString Problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A Return NSString Problem


  • Subject: Re: A Return NSString Problem
  • From: Graham Cox <email@hidden>
  • Date: Mon, 30 May 2011 13:26:55 +1000

On 30/05/2011, at 1:19 PM, Bing Li wrote:

> 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

>        NSArray *nodes = [xmlDoc nodesForXPath:xPath error:&err];

>                return [[nodes objectAtIndex:0] autorelease];


Your return type is NSString, but in fact you're returning NSXMLNode. Trying to treat it as a string leads to the errors you're seeing.

If the node contains the string, you need to return that instead, or if the string needs to be created from other data within the node, you need to do that.

--Graham


_______________________________________________

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

References: 
 >A Return NSString Problem (From: Bing Li <email@hidden>)

  • Prev by Date: A Return NSString Problem
  • Next by Date: Re: Linearly Scaling Text
  • Previous by thread: A Return NSString Problem
  • Next by thread: Re: A Return NSString Problem
  • Index(es):
    • Date
    • Thread