打开图形动作 [英] Open Graph Action

查看:104
本文介绍了打开图形动作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图运行一个提供开放图表动作的Facebook的例子,但没有任何反应。
调试时,我看到该动作被创建,但是在[FBDialogs presentShareDialog ...]中,它只是跳过并跳转到该函数的末尾。你为什么认为这是我读到这个共享对象不能在IOS模拟器中运行,但是不应该产生错误或某些东西?或者如果我在模拟器上运行它应该没有什么事实发生?

I am trying to run an example of a facebook provided Open Graph Action but nothing happens. When debugging I see that action is created but at [FBDialogs presentShareDialog...] it just skips over and jump to the end of the function. Why do you think this is? I read that the sharedialog cant run in the IOS simulator but shouldn't produce an error or something? Or if I run it on the simulator should nothing acctually happen?

-(IBAction)ShareFB:(id)sender{
id<FBOpenGraphAction> action = (id<FBOpenGraphAction>)[FBGraphObject graphObject];
[action setObject:@"https://example.com/book/Snow-Crash.html" forKey:@"book"];

 [FBDialogs presentShareDialogWithOpenGraphAction:action
                                      actionType:@"books.reads"
                             previewPropertyName:@"book"
                      handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
                                             if(error) {
                                                 NSLog(@"Error: %@", error.description);
                                             } else {
                                                 NSLog(@"Success!");
                                             }
                                         }];

参考文字: https://developers.facebook.com/docs/ios/share-dialog/#tips

推荐答案

我的iOS开发经验为零,但这个例子就是使用自托管对象,这意味着Open Graph对象定义是在特定URL中指定的HTML标记中找到的Facebook服务器获取和解析。您的示例正在 https://example.com/book/Snow- Crash.html

I have zero iOS dev experience, but it looks like that example is using a Self-Hosted Object, meaning the Open Graph object definitions are found in HTML markup specified in a particular URL that the Facebook server fetches and parses. Your example is looking for some "book" object at https://example.com/book/Snow-Crash.html

看起来这是一个简单的URL,例如清单,并且不包含book的任何实际的Open Graph属性。有一个可从Facebook获取的工具来阅读URL,并查看关于Open Graph对象的Facebook寻找和获取的工具: https://developers.facebook.com/tools/debug/og/object?q=https%3A%2F%2Fexample .com%2Fbook%2FSnow-Crash.html

It looks like this was a simple URL for example sake and does not contain any of the actual Open Graph properties for a 'book.' There's a tool available from Facebook to read URLs and see what Facebook looks for and gets when concerned with Open Graph objects: https://developers.facebook.com/tools/debug/og/object?q=https%3A%2F%2Fexample.com%2Fbook%2FSnow-Crash.html

基本上,您将需要设置一个网站,并在特定的URL上定义一些对象特定元标签。请阅读此处了解更多信息: https://developers.facebook.com/ docs / opengraph / using-objects /

Basically, you will need to have a website set up and define the object at a specific URL with some specific Meta Tags. Read up on here for more information on this: https://developers.facebook.com/docs/opengraph/using-objects/

这篇关于打开图形动作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆