0
- (void)authorize:(NSArray *)permissions {
self.permissions = permissions;

[self authorizeWithFBAppAuth:NO safariAuth:NO];

}

好的,上面的代码就是我要实现的。但是这段代码给了我两个错误。第一个是在 Facebook 中找不到的属性权限,第二个是实例授权 authorizeWithFBAppAuth: 未找到。这是共享工具包 2.0,所以也许这对它不起作用,但我需要阻止 Facebook 应用程序弹出。PS我是一个Sharekit菜鸟。

     - (void)authorize:(NSArray *)permissions {

// if we already have a session, git rid of it
[self.session close];
self.session = nil;
[self.tokenCaching clearToken];

self.session = [[[FBSession alloc] initWithAppID:_appId
                                     permissions:permissions
                                 urlSchemeSuffix:_urlSchemeSuffix
                              tokenCacheStrategy:self.tokenCaching]
                autorelease];

[self.session openWithCompletionHandler:^(FBSession *session, FBSessionState status, NSError *error) {
    switch (status) {
        case FBSessionStateOpen:
            // call the legacy session delegate
            [self fbDialogLogin:session.accessToken expirationDate:session.expirationDate];
            break;
        case FBSessionStateClosedLoginFailed:
            { // prefer to keep decls near to their use

                // unpack the error code and reason in order to compute cancel bool
                NSString *errorCode = [[error userInfo] objectForKey:FBErrorLoginFailedOriginalErrorCode];
                NSString *errorReason = [[error userInfo] objectForKey:FBErrorLoginFailedReason];
                BOOL userDidCancel = !errorCode && (!errorReason ||
                                                    [errorReason isEqualToString:FBErrorLoginFailedReasonInlineCancelledValue]);

                // call the legacy session delegate
                [self fbDialogNotLogin:userDidCancel];
            }
            break;
        // presently extension, log-out and invalidation are being implemented in the Facebook class 
        default:
            break; // so we do nothing in response to those state transitions
    }
}];
 }

上面的代码是共享工具包 2.0 附带的原始代码,如果有办法阻止 Facebook 应用程序在上面的代码中弹出,请告诉我。

4

1 回答 1

0

使用如下:

- (void)authorize:(NSArray *)permissions 
{
self.permissions = permissions;

[self authorizeWithFBAppAuth:NO safariAuth:YES];

}

然后检查。

于 2013-02-20T02:50:20.307 回答