Facebook SDK iOS访问代码问题

Facebook SDK iOS访问代码问题,ios,facebook,sdk,Ios,Facebook,Sdk,我的项目是在我的iPhone应用程序上获取我的粉丝页面的Facebook Insights数据 我开始安装facebooksdkforios来获取访问代码&而不是使用facebookiosdk提供的SampleLoginSample示例程序 它的工作非常完美&给出了与facebookapi explorer相同的查询响应 [self.textNoteOrLink setText: [NSString stringWithFormat:@"https://graph.facebook.co

我的项目是在我的iPhone应用程序上获取我的粉丝页面的Facebook Insights数据

我开始安装facebooksdkforios来获取访问代码&而不是使用facebookiosdk提供的SampleLoginSample示例程序

它的工作非常完美&给出了与facebookapi explorer相同的查询响应

[self.textNoteOrLink setText:
    [NSString stringWithFormat:@"https://graph.facebook.com/[PAGEID]?fields=likes&access_token=%@",appDelegate.session.accessTokenData.accessToken]];
但如果我在下面写查询,它不会像Facebook Explorer API那样给我回复

查询:

[self.textNoteOrLink setText:
    [NSString stringWithFormat:@"https://graph.facebook.com/PAGEID/insights/page_fans?access_token=%@",appDelegate.session.accessTokenData.accessToken]];
答复:

{"data":[

],"paging":{

"previous":"https:\/\/graph.facebook.com\/PAGEID\/insights\/page_fans?access_token=CAA...snip...h2l&since=1378984583&until=1379243783","next":"https:\/\/graph.facebook.com\/PAGEID\/insights\/page_fans?access_token=CAA...snip...h2l&since=1379502983&until=1379762183"}}
有人能帮我在Facebook iOS SDK中获得具有get_insights权限的访问代码吗?

SLAppDelegate.h
@property
列表下,添加:

-(BOOL)openSessionWithAllowLoginUI:(BOOL)allowLoginUI;
/*
 * Opens a Facebook session and optionally shows the login UX.
 */
- (BOOL)openSessionWithAllowLoginUI:(BOOL)allowLoginUI {
    NSArray *permissions = [[NSArray alloc] initWithObjects:
                            @"read_insights",
                            nil];
    
    return [FBSession openActiveSessionWithReadPermissions:permissions
                                              allowLoginUI:allowLoginUI
                                         completionHandler:^(FBSession *session,
                                                             FBSessionState state,
                                                             NSError *error) {
                                             [self sessionStateChanged:session
                                                                 state:state
                                                                 error:error];
                                         }];
}
[appDelegate openSessionWithAllowLoginUI:NO];

SLAppDelegate.m
ApplicationIDBecomeActive
下,添加:

-(BOOL)openSessionWithAllowLoginUI:(BOOL)allowLoginUI;
/*
 * Opens a Facebook session and optionally shows the login UX.
 */
- (BOOL)openSessionWithAllowLoginUI:(BOOL)allowLoginUI {
    NSArray *permissions = [[NSArray alloc] initWithObjects:
                            @"read_insights",
                            nil];
    
    return [FBSession openActiveSessionWithReadPermissions:permissions
                                              allowLoginUI:allowLoginUI
                                         completionHandler:^(FBSession *session,
                                                             FBSessionState state,
                                                             NSError *error) {
                                             [self sessionStateChanged:session
                                                                 state:state
                                                                 error:error];
                                         }];
}
[appDelegate openSessionWithAllowLoginUI:NO];
以及:


SLViewController.h
viewDidLoad
的末尾添加:

-(BOOL)openSessionWithAllowLoginUI:(BOOL)allowLoginUI;
/*
 * Opens a Facebook session and optionally shows the login UX.
 */
- (BOOL)openSessionWithAllowLoginUI:(BOOL)allowLoginUI {
    NSArray *permissions = [[NSArray alloc] initWithObjects:
                            @"read_insights",
                            nil];
    
    return [FBSession openActiveSessionWithReadPermissions:permissions
                                              allowLoginUI:allowLoginUI
                                         completionHandler:^(FBSession *session,
                                                             FBSessionState state,
                                                             NSError *error) {
                                             [self sessionStateChanged:session
                                                                 state:state
                                                                 error:error];
                                         }];
}
[appDelegate openSessionWithAllowLoginUI:NO];
SLAppDelegate.h
@property
列表下,添加:

-(BOOL)openSessionWithAllowLoginUI:(BOOL)allowLoginUI;
/*
 * Opens a Facebook session and optionally shows the login UX.
 */
- (BOOL)openSessionWithAllowLoginUI:(BOOL)allowLoginUI {
    NSArray *permissions = [[NSArray alloc] initWithObjects:
                            @"read_insights",
                            nil];
    
    return [FBSession openActiveSessionWithReadPermissions:permissions
                                              allowLoginUI:allowLoginUI
                                         completionHandler:^(FBSession *session,
                                                             FBSessionState state,
                                                             NSError *error) {
                                             [self sessionStateChanged:session
                                                                 state:state
                                                                 error:error];
                                         }];
}
[appDelegate openSessionWithAllowLoginUI:NO];

SLAppDelegate.m
ApplicationIDBecomeActive
下,添加:

-(BOOL)openSessionWithAllowLoginUI:(BOOL)allowLoginUI;
/*
 * Opens a Facebook session and optionally shows the login UX.
 */
- (BOOL)openSessionWithAllowLoginUI:(BOOL)allowLoginUI {
    NSArray *permissions = [[NSArray alloc] initWithObjects:
                            @"read_insights",
                            nil];
    
    return [FBSession openActiveSessionWithReadPermissions:permissions
                                              allowLoginUI:allowLoginUI
                                         completionHandler:^(FBSession *session,
                                                             FBSessionState state,
                                                             NSError *error) {
                                             [self sessionStateChanged:session
                                                                 state:state
                                                                 error:error];
                                         }];
}
[appDelegate openSessionWithAllowLoginUI:NO];
以及:


SLViewController.h
viewDidLoad
的末尾添加:

-(BOOL)openSessionWithAllowLoginUI:(BOOL)allowLoginUI;
/*
 * Opens a Facebook session and optionally shows the login UX.
 */
- (BOOL)openSessionWithAllowLoginUI:(BOOL)allowLoginUI {
    NSArray *permissions = [[NSArray alloc] initWithObjects:
                            @"read_insights",
                            nil];
    
    return [FBSession openActiveSessionWithReadPermissions:permissions
                                              allowLoginUI:allowLoginUI
                                         completionHandler:^(FBSession *session,
                                                             FBSessionState state,
                                                             NSError *error) {
                                             [self sessionStateChanged:session
                                                                 state:state
                                                                 error:error];
                                         }];
}
[appDelegate openSessionWithAllowLoginUI:NO];

我应该在哪里添加这些行,作为第1行和第3行使用未声明标识符“facebook”的显示错误,ARC的错误禁止在第2行发送保留的明确消息。你能建议我在哪里向你发送或共享完整的代码供你参考吗?完整的代码共享途径:你能检查我需要在哪里添加你的代码吗建议通过Facebook API获取阅读洞察数据的行完成了所有建议,但Accesscode没有获得阅读洞察权限&它仍然没有显示我的Facebook Fanpage的阅读洞察-为您的视图共享您的代码:&输出窗口也:您能在您的Fanpage上测试它吗?如果可能,请通过Dropbox共享我的代码回家后再试一次。我应该在哪里添加这些行,作为第1行和第3行中使用未声明标识符“facebook”的显示错误,ARC的错误禁止在第2行中发送保留的明确消息。您能建议我在哪里向您发送或共享完整的代码以供参考吗?完整的代码通过以下方式共享:可以吗检查我需要在哪里添加您的建议行以通过Facebook API获取阅读洞察数据完成了您建议的所有操作,但Accesscode未获得阅读洞察权限&它仍然未显示我的Facebook Fanpage的阅读洞察-为您的视图共享您的代码:&输出窗口也:您可以在您的Fanpage上进行测试并共享我的代码吗如果可能的话,我会在回家后再试一次。