• 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: NSAttributedString and HTML
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Re: NSAttributedString and HTML (From: Jonathan Jackel <email@hidden>)

  • Prev by Date: Re: NSAttributedString and HTML
  • Next by Date: Scaling down an image proportionally
  • Previous by thread: Re: NSAttributedString and HTML
  • Next by thread: Re: NSAttributedString and HTML
  • Index(es):
    • Date
    • Thread