您好我正在使用ios8将Facebook从iphone应用程序共享到Facebook的图像,当我点击照片按钮时,我收到此错误"操作无法完成。 (com.facebook.sdk错误8.)
这是我用来将iphone应用程序中的图像共享给Facebook的代码。
- (IBAction)photo:(id)sender
{
FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
[login logInWithReadPermissions:@[@"email"] handler:^(FBSDKLoginManagerLoginResult *result, NSError *error)
{
if (error)
{
// Process error
}
else if (result.isCancelled)
{
// Handle cancellations
}
else
{
if ([result.grantedPermissions containsObject:@"email"])
{
//NSLog(@"result is:%@",result);
[self photo];
}
}
}];
}
- (void)photo
{
FBSDKAccessToken *token = [FBSDKAccessToken currentAccessToken];
FBSDKGraphRequestConnection *connection = [[FBSDKGraphRequestConnection alloc] init];
UIImage *image = [UIImage imageNamed:@"TEST.png"];
NSDictionary *parameters = @{
@"message" : @"welcome",
@"picture" : UIImagePNGRepresentation(image),
};
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:@"me/photos" parameters:parameters tokenString:token.tokenString version:@"nil" HTTPMethod:@"POST"];
[connection addRequest:request completionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
if(error)
NSLog(@"%@", error);
else
NSLog(@"Success");
}];
[connection start];
}
这是我得到的错误
fb sharing[1065:90399] Error Domain=com.facebook.sdk.core Code=8 "The operation couldn’t be completed. (com.facebook.sdk.core error 8.)" UserInfo=0x155c7720 {com.facebook.sdk:FBSDKGraphRequestErrorGraphErrorCode=2500, com.facebook.sdk:FBSDKGraphRequestErrorParsedJSONResponseKey={
body = {
error = {
code = 2500;
"fbtrace_id" = ErePY87sZ34;
message = "Unknown path components: /me/photos";
type = OAuthException;
};
};
code = 400;
}, com.facebook.sdk:FBSDKGraphRequestErrorHTTPStatusCodeKey=400, com.facebook.sdk:FBSDKErrorDeveloperMessageKey=Unknown path components: /me/photos, com.facebook.sdk:FBSDKGraphRequestErrorCategoryKey=0}
感谢任何帮助。