Reputation: 293
I'm trying to post a message on my Facebook page and it works fine but the post is visible only to me. My friends don't see it! It seems like it's not "public".
I have set defaultAudience:FBSessionDefaultAudienceEveryone
so it should post to everyone, not only for me.
Here is my code :
-(void)postOnFacebook
{
if (FBSession.activeSession.isOpen)
[self postOnWall];
else
{
[FBSession openActiveSessionWithPublishPermissions:[NSArray arrayWithObjects:@"publish_actions", nil]
defaultAudience:FBSessionDefaultAudienceEveryone
allowLoginUI:YES
completionHandler:^(FBSession *session,
FBSessionState status,
NSError *error)
{
if (error)
NSLog(@"Login failed");
else if (FB_ISSESSIONOPENWITHSTATE(status))
[self postOnWall];
}];
};
}
- (void)postOnWall
{
FBRequestConnection *newConnection = [[FBRequestConnection alloc] init];
FBRequestHandler handler =
^(FBRequestConnection *connection, id result, NSError *error) {
[self requestCompleted:connection forFbID:@"me" result:result error:error];
};
NSMutableDictionary *params = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
@"pippo", @"message",
nil];
FBRequest *request=[[FBRequest alloc] initWithSession:FBSession.activeSession graphPath:@"me/feed" parameters:params HTTPMethod:@"POST"];
[newConnection addRequest:request completionHandler:handler];
[requestConnection cancel];
requestConnection = newConnection;
[newConnection start];
}
Upvotes: 0
Views: 2839
Reputation: 20753
One possible reason could be that your App is in development mode, so the posts made by you using this app will only be visible to the developers/testers added.
So you can do 2 things-
Remove the app from development mode and make it live.
Add some friends as testers/developers/administrators.
Upvotes: 1
Reputation: 1249
Need to give permission to your app to access Facebook..
[FBSession openActiveSessionWithPublishPermissions:[NSArray arrayWithObjects:@"publish_actions","email",@"friends_location",@"status_update",@"publish_stream", nil]
defaultAudience:FBSessionDefaultAudienceEveryone
allowLoginUI:YES
completionHandler:^(FBSession *session,
FBSessionState status,
NSError *error)
Hope this helps you..
Upvotes: 0