Twitter on ios - How is permission granted to do tweets?

浪子不回头ぞ 提交于 2019-12-11 05:56:30

问题


I'm wondering how are permission granted? Is there a popup that asks for permission when a tweet is about to occur or is signing in with your twitter account in your settings page permission already?

I created a game where I want to do automatic tweet for the user, and i'm wondering how will I get the user's permission to do so?

I am using iOS 5's built in Twitter Framework, any help is much appreciated.

Thanks in advance.


回答1:


If you're using the Twitter framework, then permissions are all handled by iOS itself so you don't have to do anything.

If a user hasn't yet authorized a Twitter account with their device, iOS will prompt it for you once you attempt to use the API, and it'll handle signing in and authorizing with your application for you. Once that is done you will have access to the account from the framework. See Single Sign-On for details.

Of course, you'll still need to handle a user rejecting the prompt and opting not to post a tweet from your application as well, and not just authorizing.




回答2:


If you are using the native api, then the permission is granted automatically. For this the user need to login to the twitter account from the settings APP.

Twiiter login in the settings App:




回答3:


Permission is granted by default if you use native sharing dialog provided by iOS.




回答4:


    ACAccountStore *accountStore = [[ACAccountStore alloc] init];

        ACAccountType *accountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];
        [accountStore requestAccessToAccountsWithType:accountType options:nil completion:^(BOOL granted, NSError *error) {
            if(granted) {
//Now you can do everything with your twitter account.
            }}];


来源:https://stackoverflow.com/questions/13598952/twitter-on-ios-how-is-permission-granted-to-do-tweets

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!