1
我正在使用Facebook SDK 3.0登錄用戶,並且我正在成功獲取其FB ID和FB會話令牌。無法從ios sdk發佈帖子
`NSDictionary<FBGraphUser> *user.id` (FB ID)
和 [FBSession.activeSession accessToken]
(FB會話令牌)
現在我想喜歡我的應用程序內的職位。所以我創建一個POST請求,並傳遞參數這樣
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://graph.facebook.com/%@/og.likes",@"34856345..."]] cachePolicy:NO timeoutInterval:5.0];
[urlRequest addValue:@"BAAGjjgD8bhUBAM73jzkpy23zlHo7e8ZAqPaOGvbxU..." forHTTPHeaderField:@"access_token"];
[urlRequest addValue:myshareLink forHTTPHeaderField:@"object"];
[urlRequest setHTTPMethod:@"POST"];
NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:urlRequest delegate:self startImmediately:YES];
[theConnection autorelease];
,但我得到這個錯誤
result:{"error":{"message":"An access token is required to request this resource.","type":"OAuthException","code":104}}
,但如果我使用curl命令相同的訪問令牌和用戶ID它成功職位。
curl -X POST -F 'access_token=BAAGjjgD8bhUBAE8XmogjJZAZAPyJ8SUyxkllJQ...' -F 'object=http://xyz.com/abc/gallery.php#pic/pic2/' https://graph.facebook.com/732../og.likes
請幫我弄清楚我缺少的東西。
感謝