self.myTextField.stringValue = @"" fails
self.myTextField.stringValue = @"" fails
- Subject: self.myTextField.stringValue = @"" fails
- From: Antonio Nunes <email@hidden>
- Date: Tue, 08 May 2012 18:15:50 +0200
Hi,
I have a text field that when I try to set it to a literal string fails:
This is the code:
self.myTextField.stringValue = @""; (It also fails if the literal string is not empty).
This is the (partial) backtrace:
2012-05-08 18:09:28.516 MyApp[18775:507] *** Assertion failure in -[NSTextFieldCell _objectValue:forString:errorDescription:], /SourceCache/AppKit/AppKit-1138.32/AppKit.subproj/NSCell.m:1564
Catchpoint 7 (exception thrown).2012-05-08 18:09:31.742 MyApp[18775:507] Invalid parameter not satisfying: aString != nil
2012-05-08 18:09:31.845 MyApp[18775:507] (
0 CoreFoundation 0x00007fff90d12fc6 __exceptionPreprocess + 198
1 libobjc.A.dylib 0x00007fff8c3f4d5e objc_exception_throw + 43
2 CoreFoundation 0x00007fff90d12dfa +[NSException raise:format:arguments:] + 106
3 Foundation 0x00007fff92db1743 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 169
4 AppKit 0x00007fff8a9495a5 -[NSCell _objectValue:forString:errorDescription:] + 160
5 AppKit 0x00007fff8a9494ff -[NSCell _objectValue:forString:] + 19
6 AppKit 0x00007fff8a949465 -[NSCell setStringValue:] + 41
7 AppKit 0x00007fff8aa4a5e8 -[NSControl setStringValue:] + 115
However, when I set it like this…
self.myTextField.stringValue = [NSString string];
…it has no issues.
Can anyone explain to me why the former doesn't work? I have many instances of setting a textfield with an empty literal string elsewhere in my code, and it doesn't cause problems. This particular textfield lives in a toolbar, but I assume that shouldn't matter.
-Ant´ønio
----------------------------------------------------
It is better to light a candle than to curse the darkness
----------------------------------------------------
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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