我正在创建一个iOS应用。我需要使用我的应用程序发布一些链接到Facebook事件。我已经集成了Facebook SDK。通过使用Facebook Graph API,我找到了相同的代码,它在Graph API Explorer中工作正常。但它不适用于我的应用程序。当试图将链接发布到Facebook时,它显示以下错误。我正在使用Xcode 7.3和iOS 9。
error=Error Domain=com.facebook.sdk.core Code=8 "(null)" UserInfo={com.facebook.sdk:FBSDKGraphRequestErrorCategoryKey=0, com.facebook.sdk:FBSDKGraphRequestErrorHTTPStatusCodeKey=403, com.facebook.sdk:FBSDKErrorDeveloperMessageKey=(#200) Insufficient permission to post to target on behalf of the viewer, com.facebook.sdk:FBSDKGraphRequestErrorGraphErrorCode=200, com.facebook.sdk:FBSDKGraphRequestErrorParsedJSONResponseKey={
body = {
error = {
code = 200;
"fbtrace_id" = DWR8SW4K1Ls;
message = "(#200) Insufficient permission to post to target on behalf of the viewer";
type = OAuthException;
};
};
code = 403;
我的代码如下。
-(void)postToFacebook
{
if ([[FBSDKAccessToken currentAccessToken] hasGranted:@"publish_actions"]) {
[self post];
// TODO: publish content.
} else {
FBSDKLoginManager *loginManager = [[FBSDKLoginManager alloc] init];
[loginManager logInWithPublishPermissions:@[@"publish_actions"]
fromViewController:self
handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {
if(error)
{
NSLog(@"error=%@",error);
}
else{
[self post];
}
//TODO: process error or result.
}];
}
}
-(void)post
{
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
initWithGraphPath:3466734743/feed
parameters:@{ @"link": @"http://www.dhip.in/ofc/metatest.html",}
HTTPMethod:@"POST"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
// Insert your code here
if(error)
{
NSLog(@"error=%@",error);
}
else
{
NSLog(@"success");
}
}];
}
我调查了https://developers.facebook.com/docs/ios/ios9并在我的info.plist中尝试了LSApplicationQueriesSchemes的所有组合。请帮助我。问题是什么?为什么我不能发布到Facebook?
答案 0 :(得分:0)
$.ajax({
type: "POST",
url: "php/form-process.php",
data: "name=" + name + "&email=" + email + "&telefon=" + telefon + "&konu=" + konu + "&sektor=" + sektor + "&message=" + message,
contentType: "application/x-www-form-urlencoded;charset=UTF-8",
success : function(text){
if (text == "success"){
formSuccess();
} else {
formError();
submitMSG(false,text);
}
}
});