I am using TWTweetComposeViewController to access a user's twitter account(s), which he/she has added in Settings -> Twitter. When the app attempts to access a twitter account, it should presente an alert with a message similar to this:
"[AppName] Would Like Access to Twitter Accounts"
To which you can tap either "Don't allow" or "OK". I suppose this is an alert displayed by the OS itself, since tapping "OK" actually enables access to twitter.
The above alert is displayed when I test it on an iOS 5.x device, but that is not the case when I test it on an iOS 6 device. I expect the alert to be presented when I send the following message, and I have not yet gained my app access to Twitter in settings:
[TWTweetComposeViewController canSendTweet]
As described, it does not happen. Does anyone know if this is a known bug in iOS 6? I have been unable to find any posts on SO and since I can find no other reason to the different behavior I believe it's a bug.
FYI, I am testing this on the following two devices:
Update
I use DETweetComposeViewController, which checks for iOS 5 in the following way:
+ (BOOL)de_isIOS5
{
return (NSClassFromString(@"NSJSONSerialization") != nil);
}
But since the NSJSONSerialization class is represented in iOS 6 as well, this shouldn't be the reason.
I have been sorting this same thing out on iOS 5.1 vs iOS 6.0 all day.
As long as there is a Twitter account configured in Settings, my app no longer asks for Twitter access permission in iOS 6.0 just to display a TWTweetComposeViewController
. I have verified this by manually turning off Twitter access for my app in Settings > Privacy > Twitter
. With access off, I am properly denied the ability to create a friendship using TWRequest, but can still pop up the TWTweetComposeViewController
. I get a prompt in iOS 5.1 every time until I grant it access.
This makes sense to me. All TWTweetComposeViewController
does is initiate the tweet, so if the user already has a device-wide Twitter account configured, that should be permission enough to send tweets from anywhere. It really is an unnecessary extra step to have to grant access on a per-app basis.
If no Twitter accounts are configured yet, TWTweetComposeViewController
will prompt with this message tho:
No Twitter Accounts
There are no Twitter accounts
configured. You can add or create
a Twitter account in Settings.
with handy buttons "Settings" and "Cancel".
A sidenote to this: iOS 6 also only prompts with the "[AppName] Would Like Access to Twitter Accounts"
message the first time an app requests access.
After that you must reset Settings > General > Reset > Reset Location & Privacy
to get the ask prompt back. Even if you delete and reinstall/rebuild an app, the "already asked once" setting persists. You can manually enable access in Settings > Privacy
, but that reset is the only way to get the prompt to redisplay (if that is important to your testing).
Two extra things I found out. In the completion block of [ACAccountStore requestAccessToAccountsWithType:options:completion:]
, if granted == NO
:
[error code] == 6
, your user has no accounts defined.error == nil
, your user denied access for your app, either just now or previously. If it happened previously, the request is silently ignored with no alert displayed on the screen, no "Don't Allow" button to tap.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With