tags:

views:

253

answers:

1

I trying to save app state on processing event applicationWillTerminate. But NSUserDefaults:setObject crashes in 30% cases if UIAlertView with UITextField present on screen. Call stack looks like

[NSUserDefaults setObject]
[NSNotificationCenter postNotificationName]
_CFXNotificationPostNotification
__CFXNotificationPost
_nsnote_callback
[UIKeyboardImpl defaultsDidChange]
[UIKeyboardImpl takeTextInputTraitsFrom]
[NSObjectCopy]
[UITextInputTraits copyWithZone]
[UITextInputTraits takeTraitsFrom]
[UITextInputTraits setInsertionPointColor]
objc_setProperty
objc_msgSend

Then CBR: Program received signal "EXC_BAD_ACCESS". How I can fix it? Thanks.

+1  A: 

I am not as proficient in Objective-C but I'd think that you try to store an object that is actually null or an otherwise bad pointer. To investigate that more, you can either plaster the relevant parts with log messages or step through with the debugger.

RobertB