Search code examples
iosobjective-cfacebookfacebook-graph-apiacaccountstore

Why is a private Facebook post via iOS ACAccountStore visible to the public?


In an iOS App (Objective-C) I send messages with video and the user can select if it is private, for friends, or visible to the public. That worked fine for a long time but I recently discovered that messages that were sent with "audience = ACFacebookAudienceOnlyMe" are also visible to the public. Posting with "audience = ACFacebookAudienceFriends" is still working as expected. My codes hasn't changed and I don't know if this behavior appeared in iOS9 or if it is a problem with Facebook. Does anybody has noticed a similar behavior?

The relevant code is:

NSString * audience;
switch ([[messageOptions objectForKey:@"permission"]intValue]) {
case 0:
    audience = ACFacebookAudienceOnlyMe;
    break;
case 1:
    audience = ACFacebookAudienceFriends;
    break;
case 2:
    audience = ACFacebookAudienceEveryone;
    break;
default:
    audience = ACFacebookAudienceOnlyMe;
    break;
}

NSMutableDictionary *dict = [[NSMutableDictionary alloc]      initWithObjectsAndKeys:@"XXXXMyAppIDKeyXXXX", ACFacebookAppIdKey, permissions, ACFacebookPermissionsKey, audience, ACFacebookAudienceKey, nil];
__block ACAccount * facebookAccount;
[self.accountStore requestAccessToAccountsWithType:facebookAccountType options:dict completion:^(BOOL granted, NSError *error) {
    if (granted && error == nil) {... send message and video here..}

The Dictionary "dict" looks like this when printed with NSLog directly before sending:

   {
    ACFacebookAppIdKey = XXXXMyAppIDKeyXXXX;
    ACFacebookAudienceKey = me;
    ACFacebookPermissionsKey =     (
        "publish_actions"
    );
    }

When Posting for friends ACFacebookAudienceKey is "friends".


Solution

  • It seems that it was a temporary problem, after some weeks I can not reproduce the behavior.