wordpress-mobile/WordPress-iOS — pull request #1169 by astralbodies (2014-02-04 15:13:17+00:00)
Title: Issue/1141 invalid device token

Fixes #1141

Cleaned up a number of things surrounding the addition and deletion of the push token with a key of NotificationsDeviceToken into user defaults. There were a couple missing synchronize calls after making the changes.

Also explicitly calling save on the contexts after changing the WPAccount upon creation. Moved some of the code in prepareForDeletion and put it into the call for removing the default WordPress account. This will need further review as we fully support multiple WP.com accounts. Also put a conditional in to only perform the prepareForDeletion code when inside of the main context to prevent duplication when a child context deletes first.