• 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: Appending string to NSTextView crashing app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Appending string to NSTextView crashing app


  • Subject: Re: Appending string to NSTextView crashing app
  • From: PGM <email@hidden>
  • Date: Tue, 24 Apr 2007 23:52:50 -0400


On 24-Apr-07, at 23:24 PM, Evan Moseman wrote:

Thanks for the reply, I made the changes you suggested:

- (void)appendString:(NSString *)string toView:(NSTextView *)view
{
  if (string == nil) { return; }
  string = [string stringByAppendingString:@"\n"];
  NSAttributedString *stringToAppend =
    [[NSAttributedString alloc] initWithString:string];
  [[view textStorage] appendAttributedString:stringToAppend];
  [stringToAppend release];
}

Even shorter (typed in Mail):

- (void)appendString:(NSString *)string toView:(NSTextView *)view
{
	if(string != nil){
		[[[view textStorage] mutableString] appendFormat:@"%@\n", string];
	}
}

Apparently, your error must come from somewhere else than this method, can you post some code where you call this method?

Cheers, Patrick
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Appending string to NSTextView crashing app
      • From: Evan Moseman <email@hidden>
References: 
 >Appending string to NSTextView crashing app (From: Evan Moseman <email@hidden>)
 >Re: Appending string to NSTextView crashing app (From: Ryan Stevens <email@hidden>)
 >Re: Appending string to NSTextView crashing app (From: Evan Moseman <email@hidden>)

  • Prev by Date: Re: Appending string to NSTextView crashing app
  • Next by Date: Re: Appending string to NSTextView crashing app
  • Previous by thread: Re: Appending string to NSTextView crashing app
  • Next by thread: Re: Appending string to NSTextView crashing app
  • Index(es):
    • Date
    • Thread