0
我有OneDrive问题。如何注销iOS OneDrive权限UI
我在本站点测试了OneDrive示例应用程序。 https://github.com/OneDrive/onedrive-sdk-ios
步骤:
如果我想登录其他帐户,我必须在权限界面中点击“是”按钮。并注销并重新登录。
如何在权限界面中点击“取消”或“否”按钮时注销。
这是代码:
[ODClient authenticatedClientWithCompletion:^(ODClient *client, NSError *error){
if (!error){
self.client = client;
[self loadChildren];
dispatch_async(dispatch_get_main_queue(), ^(){
self.navigationItem.rightBarButtonItem = self.actions;
});
}
else{
[self showErrorAlert:error];
}
}];
当我点击“取消”或许可UI“否”按钮,误差不为零。所以客户端(ODClient)是零。 然后可以调用注销方法。 (self.client为零)
- (void)signOutAction{
[self.client signOutWithCompletion:^(NSError *signOutError){
self.items = nil;
self.items = [NSMutableDictionary dictionary];
self.itemsLookup = nil;
self.itemsLookup = [NSMutableArray array];
self.client = nil;
self.currentItem = nil;
self.title = @"OneDrive";
dispatch_async(dispatch_get_main_queue(), ^(){
self.navigationItem.hidesBackButton = YES;
self.navigationItem.rightBarButtonItem = self.signIn;
// Reload from main thread
[self.collectionView reloadData];
});
}];
}