• 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: Seeking debugging advice
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Seeking debugging advice


  • Subject: Re: Seeking debugging advice
  • From: David Aames <email@hidden>
  • Date: Fri, 27 Oct 2006 21:49:35 +0100

Hey Alan,

Thanks for that. On my way to work today it suddenly hit me what the problem was - NSTextView's storage. NSTextView uses a NSMutableString so all address locations we using the same string and that's why the watchpoint was called only once. So the solution is to copy the string before assigning it as the property of your custom object.

On 27 Oct 2006, at 15:19, Alan Smith wrote:

Hey David,

I've written several programs that heavily use NSTextView. In all of
them I've had to do this:

NSString *text = [NSString stringWithContentsOfFile: @"/…"];
[textView setString: @""];
[textView setString: text];

The part you should take note of is where I set the string to a blank
string. I would have a whole files worth of text in the view and then
change it to the contents of another file. If I didn't have that line
that first set the string to a blank one I would get some funky bugs.
The text on screen wouldn't change and when I tried to edit it I would
get weird errors.

Hope this helps, Alan

--
// Quotes from yours truly -------------------------
"You don't forget, you just don't remember."
"Maturity resides in the mind."
"Silence is the Universe's greatest gift."
"When the World realizes that religion really is unimportant, then it
shall evolve."

_______________________________________________ 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: Re: Seeking debugging advice
      • From: "Alan Smith" <email@hidden>
References: 
 >Seeking debugging advice (From: David Aames <email@hidden>)
 >Re: Seeking debugging advice (From: "Alan Smith" <email@hidden>)

  • Prev by Date: Best practice question
  • Next by Date: Re: Best practice question
  • Previous by thread: Re: Seeking debugging advice
  • Next by thread: Re: Re: Seeking debugging advice
  • Index(es):
    • Date
    • Thread