Does it crash at the line that defines defaults, or at the setObject line?
The most likely reason to crash at setObject would be an invalid “message” object. Set a breakpoint at the line that’s crashing and examine self, message, etc.
solved nsuserdefaults setobject crashes in iOS [closed]