Re: Replacing a NSTextView's contents with NSDATA
Re: Replacing a NSTextView's contents with NSDATA
- Subject: Re: Replacing a NSTextView's contents with NSDATA
- From: Daryn <email@hidden>
- Date: Tue, 1 Apr 2003 19:19:57 -0600
The "w" in "with" should be capitalized, but that is beside the point,
because initWithString: won't work on data. Also, there's no need to
dup the notification data, and the string allocation is leaking.
Try this instead:
- (void)readAllTheData:(NSNotification *)aNotification {
id data = [[aNotification userInfo]
objectForKey:NSFileHandleNotificationDataItem];
id string = [NSString stringWithCharacter:[data bytes] length:[data
length]];
[textView setString:string];
}
On Tuesday, April 1, 2003, at 06:19 PM, Nebagakid wrote:
Ohkay, so, I got this going on. Where it gets this incoming data from
a Rendezvous source. Then I want it to set the string value of this
text view (aptly named "textView" to the data...
- (void)readAllTheData:(NSNotification *)aNotification {
NSData * data = [[NSData alloc] initWithData:[[aNotification
userInfo] objectForKey:NSFileHandleNotificationDataItem]];
[textView setString:[[NSString alloc] initwithString:[NSData data]]];
[data release];
}
but then it tells me this, what is going on?:
Exception raised during posting of notification. Ignored.
exception:
*** -[NSPlaceholderString initwithString:]: selector not recognized
Thanks y'all!
--DCohen
_______________________________________________
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.
Daryn
_______________________________________________
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.