I think EvernoteSession::authenticationToken should be rewritten as:
- (NSString *)authenticationToken
{
if (self.credentials)
return [self.credentials authenticationToken];
return nil;
}
In detail
EvernoteSession.m contains
- (void)logout
{
// remove all credentials from the store and keychain
[self.credentialStore clearAllCredentials];
// remove the store from user defaults
[self.credentialStore delete];
}
- (BOOL)isAuthenticated
{
return (self.authenticationToken != nil);
}
This on the face of it looked completely logical.
When I try to check isAuthenticated after my app has logged out, authenticationToken calls down to the credential store without checking if it exists:
- (NSString *)authenticationToken
{
return [[self credentials] authenticationToken];
}
- (ENCredentials *)credentials
{
return [self.credentialStore credentialsForHost:self.host];
}
and ends up throwing an exception from
EDAMUserStoreClient getUser: (NSString *) authenticationToken
GetUser_result(success:(null),userException:EDAMUserException(errorCode:5,parameter:"authenticationToken"),systemException:(null))













