To retrieve the information about the user’s account, call fetchAccountInfoWithCompletionHandler:
method.
#import <VerizonCloudAPI/VerizonCloudAPI.h>
PCAPISDK
object and call the fetchAccountInfoWithCompletionHandler:
method.fetchAccountInfoWithCompletionHandler:
API call using the code sample in this example.logout
API which the removes the access token stored in the keychain.authenticate:fromViewController:withCompletionHandler:
API to get a new access token.Code Sample
@try {
[[PCAPISDK sharedInstance] fetchAccountInfoWithCompletionHandler:^(PCAccountInfo *accountInfo, PCAPIQueryResponse *response) {
switch (response.urlResponse.statusCode) {
case PCAPIResponseCodeOK: {
NSLog(@"Account ID: %@", accountInfo.ID);
NSLog(@"Account alias: %@", accountInfo.alias);
NSLog(@"Total quota space available in account: %lld", accountInfo.quota);
NSLog(@"Total quota space used in account: %lld", accountInfo.quotaUsed);
}
break;
case PCAPIResponseCodeUnauthorized:
NSLog(@"Session is no longer valid");
break;
case PCAPIResponseCodeServiceUnavailable:
NSLog(@"Server Unavailable");
break;
default:
NSLog(@"Fetch account info API failed");
break;
}
}];
}
@catch (NSException *exception) {
NSLog(@"Catching %@ reason %@", [exception name], [exception reason]);
}
Copyright © 2015-2017, Verizon and/or its Licensors. All rights reserved.