I am trying to update the privacy parameter so that the live video my app starts is posted on the user's timeline with the privacy set to "ALL_FRIENDS". I have looked through the documentation and the code I have come up with does not work:
NSString* livePath = [@"/" stringByAppendingPathComponent:[token.userID stringByAppendingPathComponent:@"live_videos"]];
FBSDKProfile *profile = [FBSDKProfile currentProfile];
if(profile.userID){
livePath = [@"/" stringByAppendingPathComponent:[profile.userID stringByAppendingPathComponent:@"live_videos"]];
}
NSMutableDictionary* param = @{
}.mutableCopy;
[param setObject:@"Test Title" forKey:@"title"];
[param setObject:@"Test Description" forKey:@"description"];
[param setObject:@"privacy" forKey:@"{@\"value\": \"ALL_FRIENDS\"}"];
[[[FBSDKGraphRequest alloc] initWithGraphPath:livePath
parameters:param
tokenString:token.tokenString
version:@"v2.6"
HTTPMethod:@"POST"]
startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) { //More code here }
I figured it out using Facebook's graph explorer (https://developers.facebook.com/tools/explorer/?method=POST&path=118477909176601%2Flive_videos&version=v3.2&privacy=%7B%27value%27%20%3A%20%27ALL_FRIENDS%27%7D&classic=0). The code for setting the param to update the privacy settings is below.
[[[FBSDKGraphRequest alloc] initWithGraphPath:livePath
parameters:@{ @"privacy": @"{'value' : 'ALL_FRIENDS'}",}
tokenString:token.tokenString
version:@"v2.6"
HTTPMethod:@"POST"]
startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {