Version 1 of my iOS app is in the App Store. It is connected to a Backendless 3.x instance (we’ll call this Backendless 1). I have been developing Version 2 of my iOS app using an entirely different Backendless 3.x instance (we’ll call this Backendless 2).
If Version 1 of my iOS app is installed on a device, a user is logged in, and I install Version 2 without deleting Version 1, then my app crashes on launch. What do I need to do in my Version 2 code to prevent this from happening? I want the user to install Version 2 as if he had never logged in before. There is no need for him to remain logged in or see any of the data in Backendless 1.
Without knowing what the error is, it would be hard to suggest a remedy. Were you able to reproduce the problem when running the app from Xcode? I assume you should be able to see the error then.
I found the problem. The crash was being caused because in Version 1.0, the User class contained different fields than in Version 2.0. On app startup, the user was still logged into 1.0 while the app attempted to access properties that didn’t exist on the user, causing the crash. The solution was to call logout synchronously on the Backendless user service prior to initializing Backendless for version 2.0 in applicationDidFinishLaunching in the App Delegate.