不确定是否有人试过这个。我想使用手机用户无法访问的帐户访问Twitter。
我看待它的方法是使用OAth(令牌/秘密)
添加推特账号我可以使用以下代码添加帐户。
NSString *token = @"blahblahblah";
NSString *secret = @"blahblahblah";
ACAccountStore *store = [[ACAccountStore alloc] init];
ACAccountCredential *credential = [[ACAccountCredential alloc] initWithOAuthToken:token tokenSecret:secret];
ACAccountType *twitterAcctType = [store accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];
ACAccount *newAccount = [[ACAccount alloc] initWithAccountType:twitterAcctType];
newAccount.credential = credential;
[store saveAccount:<#(ACAccount *)#> withCompletionHandler:<#^(BOOL success, NSError *error)completionHandler#>
[store saveAccount:newAccount withCompletionHandler:^(BOOL success, NSError *error) {
if (success) {
NSLog(@"Account was saved!");
} else {
//something went wrong, check value of error
}
}];
但是此代码存储与iphone帐户存储中的秘密相关联的用户ID。问题是,如果电话用户然后使用推特,那么账号权限仍然存在供他使用......
似乎没有实施store deleteAccount
方法
对于我的第二次尝试,我尝试仅使用创建的用户而不将其添加到帐户存储中,但我认为SaveAccount方法是验证令牌和机密并获取用户名...
任何提示???
答案 0 :(得分:4)
只是一个友好的提醒,这很可能会将您的应用程序从应用程序商店中删除,因为这很容易被归类为用户/设备上的间谍活动,如果你可以把它拉下来我疑问。
此外,请注意有数千/数百万用户从同一帐户中分离。
最后,似乎没有办法删除帐户,正如你所说,再加上为了使用它你需要使用requestAccessToAccountsWithType:withCompletionHandler:这将触发通知给用户并将使它们成为认为您要求访问他的 tweeter帐户,而非您的...