I'm developing an iOS App in Xcode and using AFNetworking to talk to the API - the API uses "X-Auth-Token". So when I log in and store the session token in the User Defaults, it works perfectly until the app is restarted - the session token doesn't work then for some reason?
The token is used in AFNetworking like so:
NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
[params setValue:@"SessionTokenFromUserDefaults" forKey:@"X-Auth-Token"];
Does anyone have any advice? (PS: the error I get from AFN when using the token after restarting is: Request failed: unauthorized (401)
How could I acheive this without logging in each session?
Thanks a lot!