简体   繁体   English

使用 Facebook 的 Sharekit 状态共享,仅在首次登录后出现问题

[英]Sharekit status sharing with Facebook, problems only after first login

I am sharing an URL with sharekit facebook like this:我正在与共享套件 facebook 共享 URL,如下所示:

NSURL *url = [NSURL URLWithString:someurl];
SHKItem *item = [SHKItem URL:url title:@"Some text"];
[SHKFacebook shareItem:item];

The first time this is shared, I am directed to the facebook login and I allow the app to post on my status.第一次共享时,我被定向到 facebook 登录,我允许应用发布我的状态。 But then my status shows up empty in the share dialog.但随后我的状态在共享对话框中显示为空。

If I close the app (fully) and restart, my login is in place and the content is shared beautifully.如果我(完全)关闭应用程序并重新启动,我的登录就到位并且内容共享得很漂亮。 But right after the first login, it fails with an empty status.但在第一次登录后,它以空状态失败。 Did anyone experience this before?以前有人经历过吗? Any ideas?有任何想法吗?

It seems that ShareKit does something odd when it temporarily stores the URL in a dictionary, and restores it later.当 ShareKit 将 URL 临时存储在字典中并稍后恢复时,它似乎做了一些奇怪的事情。 It does some percent escape encoding, whereas it should just store the absoluteString of the URL.它做了一些百分比的转义编码,而它应该只存储 URL 的 absoluteString。

Change line 174 in SHKItem.m from:将 SHKItem.m 中的第 174 行从:

[dictionary setObject:[URL.absoluteString stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding] forKey:@"URL"];

to:至:

[dictionary setObject:URL.absoluteString forKey:@"URL"];

Maybe you need to fix this at some other places too, but this change seemed to get it working for me.也许你也需要在其他地方解决这个问题,但这个改变似乎让它对我有用。

Take a look at this fork and its instructions: https://github.com/dagerydoo/ShareKit看看这个叉子及其说明: https://github.com/dagerydoo/ShareKit

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

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