gpt4 book ai didi

ios - 发布带有标签的照片时获取 "Unsupported FBSDKGraphRequest attachment"

转载 作者:塔克拉玛干 更新时间:2023-11-01 21:45:30 29 4
gpt4 key购买 nike

我一直在尝试使用 FBSDKGraphRequest 上传带有标题和标记 friend 的照片,但我真的很难让标签起作用。这是我得到的:

NSDictionary *parameters = @{
@"caption" : message,
@"picture" : UIImagePNGRepresentation(image),
@"tags" : @[@{@"tag_uid": @902893713061742, @"x":@0.0, @"y":@0.0},
@{@"tag_uid": @902486513129784, @"x":@10.0, @"y":@10.0}],
};

FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:@"me/photos" parameters:parameters tokenString:token.tokenString version:@"v2.3" HTTPMethod:@"POST"];
[connection addRequest:request completionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
if(error)
NSLog(@"%@", error);
else
NSLog(@"Success");
}];
[connection start];

但是每次我尝试运行它都会抛出这个错误:

FBSDKLog: Unsupported FBSDKGraphRequest attachment:(
{
"tag_uid" = 902893713061742;
x = 0;
y = 0;
},
{
"tag_uid" = 902486513129784;
x = 10;
y = 10;
}
), skipping.

我已经尝试了几种不同的方法来附加@"tags"信息,但都没有成功。有谁知道正确的方法吗?这可能吗? https://developers.facebook.com/docs/graph-api/reference/user/photos/让我这么想。

编辑:尝试在没有标签的情况下发布,然后用它们更新帖子 ID 但仍然没有成功:(

最佳答案

您不能使用相同的 FBSDKGraphRequest 上传带有标题和标记 friend 的照片。您必须为不同的任务调用不同的方法,如下所示:

对于像标题和标签这样的消息:

if ([FBSDKAccessToken currentAccessToken]){
NSDictionary *params = @{
@"message": @"This is a test message",
};
[[[FBSDKGraphRequest alloc] initWithGraphPath:@"/me/feed" parameters:params HTTPMethod:@"POST"]startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
if (error)
NSLog(@"error:%@", error);
else{
UIAlertView *av = [[UIAlertView alloc]initWithTitle:@"FBSDKGraphRequest" message:@"Text Shared successfully..!" delegate:self cancelButtonTitle:@"Done" otherButtonTitles:nil, nil];
[av show];
}
}];
}

发布照片:

if ([FBSDKAccessToken currentAccessToken]){
NSDictionary *params = @{@"sourceImage":UIImagePNGRepresentation(pickedImage)};
[[[FBSDKGraphRequest alloc] initWithGraphPath:@"me/photos" parameters:params HTTPMethod:@"POST"] startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
if (!error) {
UIAlertView *av = [[UIAlertView alloc]initWithTitle:@"FBSDKGraphRequest" message:@"Image Shared successfully..!" delegate:self cancelButtonTitle:@"Done" otherButtonTitles:nil, nil];
[av show];
} else {
NSLog(@"Graph API Error: %@", [error description]);
}
}];
}

希望能帮到你...:)

关于ios - 发布带有标签的照片时获取 "Unsupported FBSDKGraphRequest attachment",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29855346/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com