我正在使用下面的代码来访问用户的 Twitter 帐户。UIAlert 只会在任何给定设备上弹出一次。这似乎是一个一次性的访问请求,一旦被授予或拒绝,您必须进入“设置”来更改它。
显然,作为开发人员,这是没有用的。我需要重新创建第一次提出问题的情况,并导致显示“不允许/允许”的 UIAlert 重新出现。
删除应用程序和所有数据,然后从 XCode 重新编译不起作用。似乎这种许可/拒绝存储在我不知道 [keychain?] 的某个地方。我怎样才能恢复设备认为以前从未授予/拒绝过此权限的所有内容,而不必进入“设置”?
ACAccountStore *accountStore = [[ACAccountStore alloc] init];
ACAccountType *accountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];
[accountStore requestAccessToAccountsWithType:accountType options:nil completion: ^ (BOOL granted, NSError *error) {
if(granted == YES){
// granted code goes here
} else {
// not granted code goes here
}
}];