• 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: Replacing a NSTextView's contents with NSDATA
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Replacing a NSTextView's contents with NSDATA (From: Nebagakid <email@hidden>)

  • Prev by Date: Replacing a NSTextView's contents with NSDATA
  • Next by Date: Re: Help for Help
  • Previous by thread: Replacing a NSTextView's contents with NSDATA
  • Next by thread: Why isn't this working???? (NSURL and files)
  • Index(es):
    • Date
    • Thread