• 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
initWithHTML problems
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

initWithHTML problems


  • Subject: initWithHTML problems
  • From: Jesus De Meyer <email@hidden>
  • Date: Sun, 19 Jun 2005 13:37:04 +0200

Hello,

I'm having a problem with initWithHTML (from NSAttributedString) in Tiger. In my app I try to convert a string that contains html code, but when use this method, my application would hang and stop doing anything.

This is the code I'm using: 

NSAttributedString *string = [[[NSAttributedString alloc] initWithHTML:[content dataUsingEncoding:[content fastestEncoding]] options:nil documentAttributes:NULL] autorelease];

When using the debugger, I hit pause and this is the backtrace:

#0    0x9000a778 in mach_msg_trap
#1    0x9000a6bc in mach_msg
#2    0x9074a4d8 in __CFRunLoopRun
#3    0x90749ddc in CFRunLoopRunSpecific
#4    0x9288b244 in -[NSRunLoop runMode:beforeDate:]
#5    0x93838838 in -[NSHTMLReader _loadUsingWebKit]
#6    0x9383811c in -[NSHTMLReader attributedString]
#7    0x938376b8 in _NSReadAttributedStringFromURLOrData
#8    0x93835e1c in -[NSAttributedString(NSAttributedStringKitAdditions) initWithData:options:documentAttributes:error:]
#9    0x000d0b74 in -[XMLFeedArticle content] at XMLFeedArticle.m:46

I don't know if this has something to do with, but the string is retrieved from an XML document, I use NSXMLParser to parse the document. When I come across some CData I do the following:

- (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock {
    NSString *s = [[NSString alloc] initWithData:CDATABlock encoding:NSISOLatin1StringEncoding];
    ...  

Thanks in advance
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: initWithHTML problems
      • From: Randy Saldinger <email@hidden>
  • Prev by Date: NSLog doesn't work with OCUnit
  • Next by Date: Re: Looking for example of this type of app.
  • Previous by thread: Re: NSLog doesn't work with OCUnit
  • Next by thread: Re: initWithHTML problems
  • Index(es):
    • Date
    • Thread