Is there a way to open a screen where I can set my Twitter account accessibility on iOS?

Asked 2 years ago, Updated 2 years ago, 132 views

Using Accounts.framework

// The process of retrieving a Twitter account
let accountStore=ACAccountStore();
let twitterAccountType=accountStore.accountTypeWithAccountTypeIdentifier(ACAccountTypeIdentifierTwitter);
let handler —ACAccountStoreRequestAccessCompletionHandler={(granted, error)in
    if(!granted){
        NSLog ("Reject")
        self.showAlertMessage(
            "I can't access my Twitter account",
            message: "Settings > Privacy > Allow access from Twitter")
    }
}
accountStore.requestAccessToAccountsWithType(twitterAccountType, options:nil, completion:handler);

If I can't access my Twitter account like this, I'm going to issue an alert and direct it to the configuration screen from the configuration button.

UIApplication.sharedApplication().openURL(string:UIApplicationOpenSettingsURLString!);

You can open your app's settings screen like this, but it's a long way to change your Twitter settings, so
Would it be possible to set up Twitter settings like permitting location information on your settings screen, or to guide you to Twitter settings?

ios swift twitter

2022-09-30 20:29

1 Answers

I'm sorry to bother you on my site, but with this method, can't you achieve your goal?

The dialog shown below appears.

override func viewDidLoad(){
  super.viewDidLoad()

  let accountStore=ACAccountStore()
  let twitterAccountType=accountStore.accountTypeWithAccountTypeIdentifierTwitter
  let handler —ACAccountStoreRequestAccessCompletionHandler={granted, error in
    if(!granted){
      NSLog("User denied access.")
    } else{
      NSLog("User granted access.")
    }
  }
  accountStore.requestAccessToAccountsWithType(twitterAccountType, handler)
}


2022-09-30 20:29

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.