Twitter on ios - How is permission granted to do t

2019-08-12 01:36发布

问题:

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.
            }}];