iosnetwork-programmingacaccountslrequest

Permission Alert in iOS when making networking request


When making a networking request using the ACAccount and SLRequest objects in iOS, an alert appears when the app runs that asks

X app would like access to Twitter accounts

with buttons for "Don't Allow" and "OK.

Where does this alert get called from? What method/object is it associated with? Where can I modify this alert and can I modify it so the user can pick from accounts?


Solution

  • It's this method [ACAccountStore – requestAccessToAccountsWithType:options:completion:] that shows this alert. that's why there's a completion block, it is only called after the user taps one of the buttons, or on some errors.

    The completion block gives you a pointer to an array of accounts if the user gives you permission, so maybe you could present another alert for him to choose from these accounts.