2014-09-25 73 views
0

有没有人在iOS中实现过Facebook通知API?Facebook通知API

我已经使用它在Android的工作,但对于iOS其给予OAuthException。 它在Beta中可能是Notification API中的一个错误?

我正在使用Facebook SDK for iOS v 3.18。

代码

NSString *notification_Id = [NSString stringWithFormat:@"/%@/notifications", friend]; 
NSString *app_token = @"APP_ID|APP_SECRET"; 


NSDictionary *dict_notification = @{@"href": url, 
            @"template": @"You have been invited to Choozr Poll by", 
            @"access_token" : app_token}; 

         /* make the API call */ 

[FBRequestConnection startWithGraphPath:notification_Id 
        parameters:dict_notification 
        HTTPMethod:@"POST" 
        completionHandler:^(
             FBRequestConnection *connection, 
             id result, 
             NSError *error 
             ) { 
             /* handle the result */ 
             if (error) { 
              NSLog(@"error: %@", error); 
             } 
               NSLog(@"%@",result); 
    }]; 

从Facebook

{ > error = { > code = 15; > message = "(#15) This method must be called with an app access_token."; > type = OAuthException; > } 
+0

您不应该在客户端上使用通知api,只能在服务器上使用。那是你应该处理这个应用秘密的唯一地方。通知是“应用程序到用户”的通知btw,不应该用于邀请人。 – luschn 2014-09-25 10:22:16

+0

thanx你的帮助:) – Arsalan 2014-09-25 10:24:20

+0

我会在服务器端实现它 – Arsalan 2014-09-25 10:25:00

回答

0

响应您需要实现服务器端代码,而不是客户端Facebook的通知API。