Start a new topic

Why is the activeUser null even though I am logged in?

What to expect if my activeUser is still null event after I call :



if ([KCSUser activeUser] == nil) {

[KCSUser createAutogeneratedUser:^(KCSUser *user, NSError *errorOrNil, KCSUserActionResult result) {

//[self loadKinveyRecords];

}];

}



Here is my log :

2013-11-07 21:26:42.256 gpsprof[25694:70b] KCSKeyChain.m:140 [ERROR] SecItemCopyMatching returned -25300 for key 'gpsprof - password'!

2013-11-07 21:26:42.258 gpsprof[25694:70b] KCSKeyChain.m:140 [ERROR] SecItemCopyMatching returned -25300 for key 'gpsprof - authtoken'!

2013-11-07 21:26:42.260 gpsprof[25694:70b] KCSKeyChain.m:140 [ERROR] SecItemCopyMatching returned -25300 for key 'gpsprof - username'!

2013-11-07 21:26:42.261 gpsprof[25694:70b] KCSGenericRESTRequest.m:79 [Network] Requesting resource: https://baas.kinvey.com/user/kid_eTazfQc_MO/

2013-11-07 21:26:42.262 gpsprof[25694:70b] KCSClient+KinveyKit2.m:28 [DEBUG] Using app key/app secret for auth: (kid_eTazfQc_MO, ) => XXXXXXXXX

2013-11-07 21:26:42.265 gpsprof[25694:70b] KCSAsyncConnection.m:125 [Network] Request resource:POST https://baas.kinvey.com/user/kid_eTazfQc_MO/

2013-11-07 21:26:42.265 gpsprof[25694:70b] KCSAsyncConnection.m:126 [Network] Request Headers:{

"Accept-Encoding" = gzip;

Authorization = XXXXXXXXX;

"Content-Length" = 2;

"Content-Type" = "application/json; charset=utf-8";

Date = "Fri, 08 Nov 2013 02:26:42 UTC";

"User-Agent" = "ios-kinvey-http/1.22.0 kcs/3.0";

"X-Kinvey-API-Version" = 3;

"X-Kinvey-Device-Information" = "iPhone_Simulator/x86_64 iPhone_OS 7.0.3 126501D2-EFC7-42A4-B97D-AEDC47E569B3";

"X-Kinvey-ResponseWrapper" = true;

}



How I can reset my activeUser credential if I got a null user...

Thank you Michael...



Resolved. I was trying to call createAutogeneratedUser but the app was crashing before the block was executed.
Michael,



Thank you for you reply,



2013-11-08 16:21:55.502 gpsprof[34428:70b] KCSKeyChain.m:140 [ERROR] SecItemCopyMatching returned -25300 for key 'gpsprof - password'!

2013-11-08 16:21:55.503 gpsprof[34428:70b] KCSKeyChain.m:140 [ERROR] SecItemCopyMatching returned -25300 for key 'gpsprof - authtoken'!

2013-11-08 16:22:04.587 gpsprof[34428:70b] KCSKeyChain.m:140 [ERROR] SecItemCopyMatching returned -25300 for key 'gpsprof - username'!

2013-11-08 16:22:04.588 gpsprof[34428:70b] KCSGenericRESTRequest.m:79 [Network] Requesting resource: https://baas.kinvey.com/user/kid_eTazfQc_MO/

2013-11-08 16:22:04.589 gpsprof[34428:70b] KCSClient+KinveyKit2.m:28 [DEBUG] Using app key/app secret for auth: (kid_eTazfQc_MO, ) => XXXXXXXXX

2013-11-08 16:22:04.592 gpsprof[34428:70b] KCSAsyncConnection.m:125 [Network] Request resource:POST https://baas.kinvey.com/user/kid_eTazfQc_MO/

2013-11-08 16:22:04.593 gpsprof[34428:70b] KCSAsyncConnection.m:126 [Network] Request Headers:{

"Accept-Encoding" = gzip;

Authorization = XXXXXXXXX;

"Content-Length" = 2;

"Content-Type" = "application/json; charset=utf-8";

Date = "Fri, 08 Nov 2013 21:22:04 UTC";

"User-Agent" = "ios-kinvey-http/1.22.0 kcs/3.0";

"X-Kinvey-API-Version" = 3;

"X-Kinvey-Device-Information" = "iPhone_Simulator/x86_64 iPhone_OS 7.0.3 43E24369-20A1-4D76-8E03-BAE0B74AC30D";

"X-Kinvey-ResponseWrapper" = true;

}

2013-11-08 16:22:12.293 gpsprof[34428:70b] KCSKeyChain.m:140 [ERROR] SecItemCopyMatching returned -25300 for key 'gpsprof - password'!

2013-11-08 16:22:12.299 gpsprof[34428:70b] KCSKeyChain.m:140 [ERROR] SecItemCopyMatching returned -25300 for key 'gpsprof - authtoken'!

2013-11-08 16:22:12.307 gpsprof[34428:70b] Active user = (null)



Inside the log, I check the value of my activeUser after the block, You can see that the activeUser is still null. I call the block on the first controller that require the activeUser.



I think, that I lost my private key (after an OSX update), then, the KinveyKit can't find anymore the keys needed to save/restore the activeUser. Maybe its why I can't have a activeUser because the value can't be saved to the related keys. I don't have access to check inside KCSKeyChain.m to debug...



Then, every time that I looking for my currentUser, my KinveyApp still looking for his old key/value, but can't find it...

Olivier,



In what condition are you finding the active user to be nil? If the user is nil before your code block, we should expect the call to createAutogeneratedUser: to execute. If there is no error in the completion block, then the user should be non-null. Is there are an error?
Login or Signup to post a comment