As of April 12th, you must go to Progress SupportLink to create new support cases or to access existing cases. Please, bookmark the SupportLink URL and use the new portal to contact the support team.
Andrea,
Please provide relevant code used to fetch the previously logged in user and downcast it.
Thanks,
Pranav
Kinvey Support
Hello Pranav
Thanks for your response. This is the code that fetches the user in AppDelegate. "WUser" is my custom User subclass.
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
Kinvey.sharedClient.userType = WUser.self
Kinvey.sharedClient.initialize(appKey: "xxxxxx", appSecret: "xxxxxxxxx")
Kinvey.sharedClient.push.registerForPush()
if let user = Kinvey.sharedClient.activeUser as? WUser {/*some init code*/}
else {
let loginController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "LoginScreenViewController")
self.window?.rootViewController = loginController
}
return true
}
Hello Pranav
Thanks for your response. Here is my initialisation code in AppDelegate. WUser is my custom User subclass.
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
Kinvey.sharedClient.userType = WUser.self
Kinvey.sharedClient.initialize(appKey: "xxxxxxx", appSecret: "xxxxxxxxxxx")
Kinvey.sharedClient.push.registerForPush()
if let user = Kinvey.sharedClient.activeUser as? WUser {/* some init code */}
else {
let loginController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "LoginScreenViewController")
self.window?.rootViewController = loginController
}
return true
}
Andrea Brueckner
Hi,
I seem to have the problem that when the app restarts and retrieves the user information of the previously logged in activeUser from the Keychain, the base class "User" is returned instead of my custom user subclass. If I try to downcast it returns nil. That means that the custom properties I have defined are not included. I then have to refresh the user from the backend (and downcast) in order to get the custom properties again.
My custom class is defined something like this:
class MyUser: User {
var profilePictureID: String?
convenience init() {
// some initialization code
}
override func mapping(map: Map) {
super.mapping(map: map)
profilePictureID <- map["profilepctureID"]
}
}
Could I be doing something wrong or is this behaviour expected?
Thank you very much for your support!