Start a new topic

Crash when moving iOS app into background if we call [KCSUser saveWithCompletionBlock]

I am updating user location at app startup, using [CLLocationManager startMonitoringSignificantLocationChanges] and then save it for activeUser. The problem is when app goes to background app crashes.

Code Sample:

if(location) {

[self setValue:location forAttribute:KCSEntityKeyGeolocation];

[self saveWithCompletionBlock:^(NSArray *objectsOrNil, NSError *errorOrNil) {

NSLog(@"Saved User Location");



This is the trace:


CoreFoundation 0x2dc10ab0 _CFXNotificationPost

Foundation 0x2e5f6ec4 -[NSNotificationCenter postNotificationName:object:userInfo:]

UIKit 0x304e2e7c -[UIApplication _handleApplicationSuspend:eventInfo:]

UIKit 0x304640c6 -[UIApplication handleEvent:withNewEvent:]

UIKit 0x30463cfc -[UIApplication sendEvent:]

UIKit 0x304c9320 _UIApplicationHandleEvent

GraphicsServices 0x3294976c _PurpleEventCallback

GraphicsServices 0x32949356 PurpleEventCallback


CoreFoundation 0x2dca5712 __CFRunLoopDoSource1

CoreFoundation 0x2dca3ede __CFRunLoopRun

CoreFoundation 0x2dc0e470 CFRunLoopRunSpecific

CoreFoundation 0x2dc0e252 CFRunLoopRunInMode

GraphicsServices 0x329482ea GSEventRunModal

UIKit 0x304c3844 UIApplicationMain

Very strange behavior from saveWithCompletionBlock, current user info is replaced by another users info. I have no code to do this. The only thing I do is saving the user after updating its location. The code I posted above is call from locationManager:didUpdateLocations. That't it. If I disable this everything is fine.
I am looking into it.
This is happening when I do [KCSUser: refreshFromServer:] on viewDidLoad. When is a good time to do a refresh?
Ali, are you using a KCSUser subclass? Or how is "self" the active user object in this case?
I'm confused again, is this a save or a refresh?
I am using Categories to extend the class. It looks like save and refresh were conflicting with each other. After removing refresh from viewDidLoad I am not seeing this kind of crash anymore, but I cannot refresh now.. But I still see the strange save behaviour that replaces current user info with other users.
I still haven't been able to reproduce, but I did find some areas of improvement. Try again after the next release (probably 1.25.1 or 1.26.0).
Do you have any release date? When is a good time for saving the user class?
Hi Ali, the release is out:
Thank you
On the SDK, this has not happened so far
Login or Signup to post a comment