2014-09-25 74 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。