简体   繁体   English

Facebook iOS整合

[英]Facebook iOS Integration

I have recently implemented the Facebook functionality to post an URL as explained in iOS Facebook Development 我最近实现了Facebook功能来发布URL,如iOS Facebook开发中所述

It's the same as explained. 和上面解释的一样。

After I've signed up on Facebook and set my app key, I started the iPhone simulator and authorized as explained on Facebook. 在Facebook上注册并设置我的应用程序密钥后,我启动了iPhone模拟器并按照Facebook上的说明进行了授权。 After that the Mobile Safari didn't jump back to my app (Because I don't want Facebook to jump back. Later I want to do that calling a webpage by my own). 之后,Mobile Safari并没有跳回我的应用程序(因为我不希望Facebook跳回。后来,我想自己调用网页)。 So I just started it again (activated because of iOS 4.2). 因此,我再次启动了它(由于iOS 4.2而被激活)。

After that, I switched to the where I post a default URL. 之后,我切换到发布默认URL的位置。

NSMutableDictionary *params = [NSMutableDictionary dictionary];

NSString *communityURL = @"http%3A%2F%2Fwww.google.com";

[params setObject:communityURL forKey:@"link"];

[facebook dialog:@"feed" andParams:params andDelegate:self];

Normally it should bring up a dialog with this parameters, but it just showed an error: 通常,它应该使用此参数打开一个对话框,但是它只是显示一个错误:

This page contains the following errors: 此页面包含以下错误:

error on line 25 at column 35: xmlParseEntityRef: no name 第25行第35列的错误:xmlParseEntityRef:无名称

Below is a rendering of the page up to the first error. 下面是直到第一个错误的页面呈现。

When I debug into the method which calls the dialog, I got the URL, which will be called. 当我调试调用对话框的方法时,我得到了将被调用的URL。 When executing this URL in a web browser, it works. 在Web浏览器中执行此URL时,它可以工作。

Why doesn't it work? 为什么不起作用? What's wrong? 怎么了?

i didn't figure out what it was, but i came up with an other solution. 我不知道这是什么,但我想出了另一种解决方案。 I now use ShareKit . 我现在使用ShareKit It's easy to use and it handles all alone. 它易于使用,并且可以单独处理。 I try to post some sourcecode snipets asap. 我尝试尽快发布一些源代码片段。

For those, who have the same problem and don't want to use another API, try to do what ever the facebook documentation tells you. 对于那些有相同问题并且不想使用其他API的用户,请尝试执行facebook文档告诉您的操作。

Br Nic Br Nic

ok what I did is simply add 好的,我所做的只是添加

NSURL *url = [NSURL URLWithString: @"http://www.google.com"];
SHKItem *item = [SHKItem URL:url title:@"Share Item with Google url ;)"];

// Get the ShareKit action sheet
SHKActionSheet *actionSheet = [SHKActionSheet actionSheetForItem:item];

// Display the action sheet

[actionSheet showFromTabBar:self.tabBarController.tabBar];

And that's what I do. 这就是我要做的。

If someone needs help, please feel free!! 如果有人需要帮助,请放心!!

Br Nic Br Nic

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM