Additional permissions for the iOS SDK for Facebook

My IOS application asks the user for permission to publish_stream, the problem is when the additional permissions screen appears and the user clicks Allow, and facebook sdk does not perform this action, because the application can publish messages on the user's wall. when I check the setting on my facebook account, I see that the permission is “mail on your behalf”. here is the code:

NSArray* permissions = [[NSArray alloc] initWithObjects:@"publish_stream", @"email",
                               @"user_birthday",@"user_relationships", @"user_location", @"user_hometown", nil];

-(void)loginToFacebook
{
    [facebook authorize:permissions];}

- (void)fbDidLogin 
{
    NSLog(@"did login");

    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    [defaults setObject:[facebookAgent accessToken] forKey:@"FBAccessTokenKey"];
    [defaults setObject:[facebookAgent expirationDate] forKey:@"FBExpirationDateKey"];
    [defaults synchronize];

[facebook requestWithGraphPath:@"me/permissions" andDelegate:self];
}

- (void)request:(FBRequest *)request didLoad:(id)result
{
    NSLog(@"%@",result);
}

if the user clicked the Allow button not on the additional permissions page, the result in the request: didLoad method:

{
    data =     (
                {
            "create_note" = 1;
            email = 1;
            installed = 1;
            "photo_upload" = 1;
            "publish_actions" = 1;
            "publish_stream" = 1;
            "share_item" = 1;
            "status_update" = 1;
            "user_birthday" = 1;
            "user_hometown" = 1;
            "user_location" = 1;
            "user_relationships" = 1;
            "video_upload" = 1;
        }
    );
}

and this is the zip code:

-(void)publishToFacebook
{   
    NSDictionary* attachment = [NSDictionary dictionaryWithObjectsAndKeys:
                                @"Name", @"name",
                                @"Caption", @"caption",
                                @"Message", @"message",
                                @"http://url...", @"link", 
                                @"http://imageUrl...", @"picture", nil];


    NSMutableDictionary* params = [NSMutableDictionary dictionaryWithDictionary:attachment];


    [facebook requestWithGraphPath:@"me/feed" 
                            andParams:params
                        andHttpMethod:@"POST"
                            andDelegate:self];
}
+3
source share

All Articles