Crash when moving iOS app into background if we call refreshFromServer:
started a topic
almost 9 years ago
We have an issue where our app crashes when it goes into the background if we make a call to [[KCSUser activeUser] refreshFromServer:…] in our AppDelegate when we're starting up our app. The crashes are often bad access, and sometimes unrecognized selector for didEnterBackground. Have you ever run into this before?
I had a similar set up (and thus issue) and contacted support about it. The response I got was "When the active user reinstated from nil using the saved credentials, the library fires off a background update on the user object. It's possible the conflicting updates create two contexts which causes the first one to be reclaimed before the notification is handled."
I fixed this with their advice by not actively calling the refreshFromServer method on launch and instead using KVO to observe completion so I could update my UI.
Provided code below that I am using in production and seems to work fine: