我正在应用程序中实现深层链接.
按照我发现的每个教程.
测试每个可能的设置.
结果是:如果我发布一个带有“user_generated”:“true”的故事,Facebook就会发布应有的大照片,但没有“Instagram上的视图”,“Foursqare上的视图”等链接.所以人们无法达到实际的目标.
Facebook设置:
显示名称,命名空间,应用程序域,站点URL,捆绑ID,iPhone商店ID,深层链接(ON),本机或桌面应用程序?(ON),是否嵌入了App Secret?(OFF)
应用限制 – 没有限制
我设置了开放图形动作和对象,它们正在工作而没有“user_generated”:“true”.
我正在发送我的代码(此示例替换了projectnamespace):
-(void) shareOnFacebook: (NSString *) image {
NSMutableDictionary<FBOpenGraphObject> *object = [FBGraphObject openGraphObjectForPost];
object.provisionedForPost = YES;
object[@"type"] = @"projectnamespace:photo";
object[@"title"] = _postText.text;
object[@"url"] = responseJson[@"share"];
object[@"og:url"] = responseJson[@"share"];
object[@"al:web"] = responseJson[@"share"];
object[@"web"] = responseJson[@"share"];
if (image) {
NSLog(@"Photo Link: %@", image);
object[@"image"] = @[@{@"url": image, @"user_generated" : @"true" }];
}
// Post custom object
[FBRequestConnection startForPostOpenGraphObject:object completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
if(!error) {
NSString *objectId = [result objectForKey:@"id"];
id<FBOpenGraphAction> action = (id<FBOpenGraphAction>)[FBGraphObject graphObject];
[action setObject:objectId forKey:@"photo"];
[action setObject: @"true" forKey: @"fb:explicitly_shared"];
if (image)
[action setImage:@[@{@"url": image, @"user_generated" : @"true" }]];
// create action referencing user owned object
[FBRequestConnection startForPostWithGraphPath:@"me/projectnamespace:add" graphObject:action completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
if(!error) {
NSString *actionId = [result objectForKey:@"id"];
NSLog(@"Posted story to facebook: %@", actionId);
[self shareAndDismiss: nil];
} else {
// An error occurred
NSLog(@"Encountered an error posting action to Open Graph: %@", error);
[self shareAndDismiss: nil];
}
}];
} else {
// An error occurred
NSLog(@"Error posting the Open Graph object to the Object API: %@", error);
[self shareAndDismiss: nil];
}
}];
}
最佳答案 据我所见,在Facebook上分享的Foursquare帖子上没有这样的“在Foursquare上查看”链接.
我所知道的唯一“View on …”链接适用于Instagram.然而Instagram是一家Facebook公司. Facebook和Instagram团队一起工作以获得他们自己的照片共享体验,这意味着他们不像我们那样受限于API.
我担心“在Instagram上观看”只是Instagram应用程序的特殊功能,并且Facebook API不会将此功能提供给其他应用程序.