我有一个使用Objective-C构建在Xcode上的应用程序。用户可以发送推文,当我尝试从我的iPhone发送它时说(无法发送推文,因为与Twitter的连接失败)。它正在使用模拟器,她是我使用的代码:
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter])
{
NSString *tweetBody = self.currentList.tweetBody;
NSString *rawStr = [NSString stringWithFormat:@"%@", tweetBody];
SLComposeViewController *composeController = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter];
[composeController setInitialText:rawStr];
[composeController addURL: [NSURL URLWithString:@"https://my app url on Apple store"]];
[self presentViewController:composeController
animated:YES completion:nil];
SLComposeViewControllerCompletionHandler myBlock = ^(SLComposeViewControllerResult result){
if (result == SLComposeViewControllerResultCancelled) {
NSLog(@"delete");
} else
{
NSLog(@"post");
}
};
composeController.completionHandler =myBlock;
}
}];
我希望能和你们找到答案。
答案 0 :(得分:0)
您是否检查过Twitter的隐私设置?您可能没有授予其访问Twitter帐户的权限。下图显示了所有已被授予访问我的Twitter帐户权限的应用程序