简体   繁体   中英

Iphone app facebook connection?

hello i have a app that connects and post to user wall but when i try to post it always open the persmission page and in that page it writes you already give permission to this app.I want it to come only 1 time can anyone help me to do that?

- (id)init {
if (self == [super init]) {
    facebook = [[Facebook alloc] initWithAppId:kAppId];
    facebook.sessionDelegate = self;
    if(permissions==nil){
    permissions =  [[NSArray arrayWithObjects:
                    @"read_stream", @"user_birthday", 
                      @"publish_stream", nil] retain];
    }
    [self login];
}
return self;

}

- (void)login {
if (![_session isConnected]) {
    [self postToWall];  
}

// only authorize if the access token isn't valid
// if it *is* valid, no need to authenticate. just move on
if (![facebook isSessionValid]) {
    [facebook authorize:permissions delegate:self];
}

is it because i init method?

See this page - https://developers.facebook.com/docs/guides/mobile/ . Basically what you want to do is save the authentication information (access_token) when the user is authorized, then next time you can check for the saved values and skip the authentication.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM