Re: A Return NSString Problem
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