On May 8, 2012, at 9:15 AM, Antonio Nunes wrote:

> 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).

That is quite bizarre. So much so that I’m assuming that this isn’t the actual 
problem, that there’s a mixup about which line is raising the exception.

> 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

So, what’s line 8? Are you *certain* that it’s the line you quoted above, and 
not some other -setStringValue: call in your code?
If you set a breakpoint on the line in question, and then step over the call, 
does the exception trigger?

The only other explanation I can think of is that some previous bug in the code 
has messed up the predefined NSString instance that @“” points to. But that 
would be hard to do — IIRC, the compile-time-constant NSStrings are somewhat 
magical and don’t track refcounts, so you can’t over-release them.

—Jens
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to