Re: NSXMLParser and NSDocument
Re: NSXMLParser and NSDocument
- Subject: Re: NSXMLParser and NSDocument
- From: Graham Cox <email@hidden>
- Date: Wed, 29 Apr 2009 11:51:50 +1000
On 29/04/2009, at 8:34 AM, Jeffrey Oleander wrote:
I've been having 2 intermittent compilation errors
on 10.3.9 in
- (BOOL)loadDataRepresentation:(NSData*)data ofType:
(NSString*)fileType
{
BOOL success;
NSString * lowercaseFileType = [fileType lowercaseString];
NSLog(@"fileType=%S", lowercaseFileType);
%S specifies a null-terminated array of 16-bit unicode characters.
What you're passing is an NSString object. So the specifier should be
the object specifier, %@.
[xmlParser setDelegate:JGOXMLParser];
The second is
error: parse error before "JGOXMLParser"
and point to
[xmlParser setDelegate:JGOXMLParser];
I understand that – loadDataRepresentation:ofType:
method is valid in 10.3.9 but deprecated in 10.4
but I have to work with what I have.
Does the delegate have to be an instance?
It has to be an instance of *something*. JGOXMLParser I'm assuming is
the name of your class. You can't have static objects in Objective-C
as you can in C++, so this statement is illegal. If you want your
class to implement the delegate methods, you could pass [JGOXMLParser
class], since a class is an object. Or you could instantiate an actual
JGOXMLParser. The latter sounds by far the less weird of the two
options.
--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