Re: NSAttributedString and HTML
Re: NSAttributedString and HTML
- Subject: Re: NSAttributedString and HTML
- From: David Remahl <email@hidden>
- Date: Sat, 21 Sep 2002 15:07:19 +0200
That won't make any difference. NULL and nil are both synonyms for 0, but
with somewhat different semantical meaning.
To the original poster; It would perhaps be enlightening to see a stack
trace where the exception is raised. Place a breakpoint at -[NSException
raise] to achieve that. As far as I can see, your code looks OK.
/ Sincerely, David Remahl
>
Have you tried changing NULL to nil?
>
>
Jonathan
>
>
on 9/21/02 1:11 AM, Chris Hanson at email@hidden wrote:
>
>
> There's got to be something I'm just missing here.
>
>
>
> I'm trying to create an attributed string with the HTML that I have
>
> in another string. I'm doing this from within an NSText delegate
>
> method, -[MyDocument textDidChange:]. I'm using Mac OS X 10.2.1 with
>
> the latest everything.
>
>
>
> Here's my code:
>
>
>
> - (NSAttributedString *)attributedStringForHTML:(NSString *)rawString
>
> {
>
> NSData *rawStringData;
>
> NSAttributedString *htmlString;
>
>
>
> rawStringData = [rawString dataUsingEncoding:NSUTF8StringEncoding];
>
>
>
> htmlString = [[[NSAttributedString alloc] initWithHTML:rawStringData
>
> documentAttributes:NULL] autorelease];
>
>
>
> return htmlString;
>
> }
>
>
>
> What's strange is that as soon as it hits -[NSAttributedString
>
> initWithHTML:documentAttributes:], it throws an exception:
>
>
>
> Exception raised during posting of notification. Ignored.
>
> exception: *** +[MyDocument attributedStringWithHTML:documentAttributes:]:
>
> selector not recognized
>
>
>
> Of course it's not recognized! I don't want to write my own HTML
>
> parser, that's what the AppKit additions to NSAttributedString are
>
> for! And how the heck is it getting at MyDocument?
>
>
>
> What's odd is that using NSAttributedString like this to work fine
>
> for projects like Cocoa Browser. And it certainly doesn't have an
>
> implementation of +[MyDocument
>
> attributedStringWithHTML:documentAttributes:]. What's going on?
>
>
>
> -- Chris
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.