Facebook API for iOS

I have included the Facebook API for iOS in my application to share the link with my facebook application. When I click "Share" from my application, it shares the link when I already logged in to facebook on my device. If not, he asks me to come in. As soon as I logged in, the window closed and he did not share this link. I need to click Share again to share the link. What I will need to use automatically after logging in. Help me.

0
source share
3 answers

Have you used the Facebook SDK for iOS ( https://developers.facebook.com/docs/mobile/ios/build/ )? I carefully followed these instructions, and it worked for me on the first try. The only trick for me was the much discussed solution, to make sure the application does not start Safari for authentication when people did not have the Facebook application, replacing:

[self authorizeWithFBAppAuth:YES safariAuth:YES];

with

[self authorizeWithFBAppAuth:YES safariAuth:NO];

in the method (void)authorize:(NSArray *)permissionson Facebook.h. But other than that, I just followed the instructions on this website above, and it worked without problems for me.

If this does not answer your question, perhaps you can post some code so that we can help diagnose what is happening. The question (in the absence of code) is a bit ambiguous.

+1
source

See my question if you have any doubts about facebook API integration.

API Facebook,

:

-(void)buttonPressed:(id)sender{
facebook = [[Facebook alloc] initWithAppId:@"YOUR_APP_ID" andDelegate:self];

 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
        if ([defaults objectForKey:@"FBAccessTokenKey"] && [defaults objectForKey:@"FBExpirationDateKey"]) {
            facebook.accessToken = [defaults objectForKey:@"FBAccessTokenKey"];
            facebook.expirationDate = [defaults objectForKey:@"FBExpirationDateKey"];
        }
if (![facebook isSessionValid]) {
    [facebook authorize:nil];
}else{
[self postWall];
}
// Pre 4.2 support
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
    return [facebook handleOpenURL:url]; 
}
- (void)fbDidLogin {
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    [defaults setObject:[facebook accessToken] forKey:@"FBAccessTokenKey"];
    [defaults setObject:[facebook expirationDate] forKey:@"FBExpirationDateKey"];
    [defaults synchronize];
    [self postWall];
}
-(void)postWall{

    NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                            @"https://developers.facebook.com/docs/reference/dialogs/",@"link",
                                   @"http://fbrell.com/f8.jpg",@"picture",
                                   @"Facebook Dialogs",@"name",
                                   @"Reference Documentation",@"caption",
                                   @"Using Dialogs to interact with users.",@"description",
                                   @"Facebook Dialogs are so easy!",@"message",
                                   nil];

    [[self facebook] dialog:@"feed" andParams:params andDelegate:self];

}
+1

( Facebook), FB Info.plist( )

. . :

... Create a new line with URL type names with one element, URL schemes containing one value, fbYOUR_APP_ID (literal characters fb and then your application identifier). The following shows how the line should appear in the .plist file ...

For instance:

URL types. [0] .URL schemes. [0] .fb1234 (where your Facebook app id is 1234)

+1
source

All Articles