Accounts framework - does unexpected things sometimes / freezes system preferences ...
Accounts framework - does unexpected things sometimes / freezes system preferences ...
- Subject: Accounts framework - does unexpected things sometimes / freezes system preferences ...
- From: Robert Vojta <email@hidden>
- Date: Sun, 12 May 2013 15:55:10 +0200
Hi all,
we do use accounts framework on Mac OS X for Facebook and we did find two issues (+- 15 % of cases) …
1. ACAccountStore returns non sense sometimes
Here's the code to check account store status, request access, etc. https://gist.github.com/robertvojta/ecc7a790664b3c432f63
This code does work on almost all testing Mac computers. But sometimes, this does happen:
- account store tell me that we do not have access (granted is 0), it's okay,
- there is Facebook account in system accounts,
- I'm going to request access via requestAccessToAccountsWithType:options:completion:
- and the result in completion handler is - granted 0, error is set, error code is 6 (= ACErrorAccountNotFound) with description Operation couldn't be completed - this is problem
[FBUFacebookAccount readPermissions] used as ACFacebookPermissionsKey value is simple array with read only permissions. We do need write permissions as well, but we're asking for them later. Permissions are okay.
What's weird - system dialog that we want to access Facebook account never appears in this case. And our app is not listed in Security & Privacy - Privacy - Facebook pane. Nothing helps - restart, add/remove Facebook account in System Preferences, etc. The only way which fixes this state is to call …
tccutil reset Facebook
… and when I do this, it works as expected. Drawback is that I can't call this because it resets granted access for all apps - it simply removes all of them. And also we're targetting MAS & Sandbox - no way to call it - and we do not want to call it at all to avoid resetting other apps which do use Facebook. Just pointing it out as "a solution" for this issue.
When I call tccutil, it fixes all issues and app, ie. ACAccountStore, does work as expected.
An idea what can be wrong? This problem did appear on 3 testing Macs (20 testing Macs in total). It's 15 % of Macs and it's huge number of users. It's not acceptable. All systems are up to date Mountain Lions (we're targetting 10.8 only).
2. System Preferences freezing
Sometimes, less frequent than mentioned 15 %, when I do receive ACAccountStoreDidChangeNotification, I'm …
- trashing currect ACAccountStore object,
- allocating new one,
- and checking accounts in the same way as I described,
… if I do this immediately when I do receive this notification, System Preferences … freezes sometimes and my app freezes as well. When I reallocated / recheck account store few seconds, let's say 5s, after I do receive notification, everything's okay. It seems that there's some kind of problem in Accounts framework, which can causes this freeze - kind of deadlock or don't know what it can be. This is on my todo list to sample both apps and check what's going on here.
Thanks for any insights,
Robert
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden