Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSAttributedString initWithHTML on Tiger??



I'm having some trouble with NSAttributedString's initWithHTML method on Tiger. This worked in an app on Panther, but on Tiger the app "hangs" (slows down) and the NSAttributedString is not initialized. I've found a thread on this here: <http://www.idevapps.com/forum/ showthread.php?t=5231>.

The problem comes about when trying to put some HTML from NSData * data into an NSAttributedString:
NSAttributedString *result = [[NSAttributedString alloc] initWithHTML:data documentAttributes:nil];


I've tried various combinations of NSMutableData, NSData, NSMutableAttributedString, init methods, and it basically seems to not work for what I want to do. Putting a string from a char* actually did work, but this was raw HTML, not what I want to do.

I made a test app to test basic functionality of initWithHTML:
NSString *coolString = [[NSString alloc] initWithString:@"<html><head><title>something</title></ head><body>some body text</body></html"];
NSData *coolData = [coolString dataUsingEncoding:NSUTF8StringEncoding];
NSAttributedString *coolResult;
coolResult = [[NSAttributedString alloc] initWithHTML:coolData documentAttributes:nil];
NSLog(@"coolResult: %@", [coolResult string]);


This actually works! BUT, when I put it back into my app EXACTLY the way it is, the app slows down and my NSLog of the result shows null.

So, for some reason, code that works in a test app does not work in my app.

Trying to debug, we found that connectionDidFinishLoading: gets called, it does the initWithHTML, and that turns around and uses "NSHTMLReader _loadUsingWebKit", which then is blocking in a runloop, thanks Mark D!

Has anyone else seen this? Any solutions? Any pointers?

Much thanks!
Steve
http://cocoaheads.org
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.