I m developing an iPhone app which includes facebook wall posting.After log in, I post to user\'s wall by following code:
NSString *appIcon = [NSString stringWit
The solution above uses FBPermissionDialog which is fine for changing the permissions after login, but you're better off just asking for the permission on the initial login. That way you are not opening up the external browser twice.
if (![facebook isSessionValid]) {
NSArray *permissions = [[NSArray alloc] initWithObjects:
@"publish_stream",
nil];
[facebook authorize:permissions];
[permissions release];
}
I have Found the solution of the problem by myself.
Actually the cause of the problem is the application doest have permission to "Post To Wall". (publish_stream).Hence FB was denying with following error.
"The user hasn't authorize this application to perform this action".
So when user logs in, Ask user to give permission of publish_stream,
- (void)session:(FBSession*)session didLogin:(FBUID)uid {
FBPermissionDialog *permissions = [[FBPermissionDialog alloc]initWithSession:_session];
permissions.permission = [NSString stringWithString: @"publish_stream"];
[permissions show];
}
`
When once the user have allowed "Post to wall", this dialog wont appear ever again.
you should have a small block of code that looks similar to this below. If not - search for read_stream in your code -
if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
_permissions = [[NSArray arrayWithObjects:
@"read_stream", @"offline_access",nil] retain];
}
Add @"stream_publish" to the list and you should be good to go.
-Jon