Skip to content

Instantly share code, notes, and snippets.

@zigdanis
Created April 2, 2014 08:12
Show Gist options
  • Save zigdanis/9929988 to your computer and use it in GitHub Desktop.
Save zigdanis/9929988 to your computer and use it in GitHub Desktop.
- (DBRestClient *)restClient
{
if (!self.user_identifier)
return nil;
if (!_restClient)
{
if ([[DBSession sharedSession] credentialStoreForUserId:self.user_identifier])
{
_restClient = [[DBRestClient alloc] initWithSession:[DBSession sharedSession] userId:self.user_identifier];
}
else
{
MPOAuthCredentialConcreteStore *store = [[DBSession sharedSession] baseCredentialStore];
[store setKeysForPersistenceResponseString:self.persistence];
_restClient = [[DBRestClient alloc] initWithSession:[DBSession sharedSession] credinalStore:store userId:self.user_identifier];
}
_restClient.delegate = self;
}
return _restClient;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment