Re: NSTextView All Weird-Like and Stuff
Re: NSTextView All Weird-Like and Stuff
- Subject: Re: NSTextView All Weird-Like and Stuff
- From: Drew McCormack <email@hidden>
- Date: Tue, 23 Oct 2001 11:44:58 +0200
Sam,
I had a difficult time with something a bit like this a few weeks back.
I couldn't figure out what was going on. In my case, it was ignorance on
my part. I wasn't copying the string I got from NSTextView, but only
retaining it.
My guess is that you should either make sure you retain the string you
get from NSTextView (presumably using "string"), or better still, copy
it. Eg
NSString *localString;
NSTextView *textView;
// set textView here
localString = [[textView string] copy];
... // Do something with it
[localString release];
Using copy is a good idea, because you don't even know that the string
you got from textView is immutable; unless you copy it, it could change
on you, or even be deallocated.
So, either retain it, or copy it, but I strongly recommend copying.
Drew
On Tuesday, October 23, 2001, at 10:48 , Sam Goldman wrote:
I am using a NSTextView for user input and things are really getting
weird...
When I get the text from it and then try to use it in any way I get this
output:
2001-10-23 01:45:08.163 CocoaChat[1256] *** Assertion failure in
-[NSMutableRLEArray replaceObjectsInRange:withObject:length:],
String.subproj/NSAttributedString.m:1036
2001-10-23 01:45:08.170 CocoaChat[1256] Delete invalid attribute range
0,10
(length 5)
2001-10-23 01:45:18.008 CocoaChat[1256] *** Assertion failure in
-[NSMutableRLEArray objectAtIndex:effectiveRange:],
String.subproj/NSAttributedString.m:923
2001-10-23 01:45:18.009 CocoaChat[1256] Access invalid attribute
location 4
(length 4)
2001-10-23 01:45:18.632 CocoaChat[1256] *** Assertion failure in
-[NSMutableRLEArray objectAtIndex:effectiveRange:],
String.subproj/NSAttributedString.m:923
2001-10-23 01:45:18.632 CocoaChat[1256] Access invalid attribute
location 4
(length 4)
CocoaChat.app has exited with status 0.
I don't really do that much to it so I don't know what's causing it. I
also
don't just want to post all my code, so if you know what this means or
think
you can solve my problem, do tell! The text is there after I get it, but
when I try to delete it, it seems like it thinks it isn't there...
Thanks,
Sam
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
================================
Dr. Drew McCormack
Department of Theoretical Chemistry
Science Faculty
Free University Amsterdam
De Boelelaan 1083
1081 HV Amsterdam
The Netherlands
Email :: email@hidden
Tel. :: +31 20 44 47623
Fax :: +31 20 44 47629