简体   繁体   中英

How to programmatically change Facebook posts visibility to “public” on iOS

Would like to change the default visibility of app and posts in Facebook from "Friends" to "Public" programmatically on iOS. Is there any example code for this? Thanks a lot in advance.

You can set defaultAudience Property .

Most applications use FBSessionDefaultAudienceNone here, only specifying an audience when using reauthorize to request publish permissions.

There are other option to set is,

FBSessionDefaultAudienceNone : No audience needed; this value is useful for cases where data will only be read from Facebook.

FBSessionDefaultAudienceOnlyMe : Indicates that only the user is able to see posts made by the application.

FBSessionDefaultAudienceFriends : Indicates that the user's friends are able to see posts made by the application.

FBSessionDefaultAudienceEveryone : Indicates that all Facebook users are able to see posts made by the application.

It appears from here and here that you can setup the privacy of the post at creation time, but you cannot edit it.

Also, per facebook's developer TOS and Privacy Policy, unless what you are doing [changing the default privacy of a post] is specifically authorized each time by the user, it'd be breaking terms of service and immediately get your app shut down. Facebook takes privacy very, very seriously.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM