简体   繁体   English

使用ios 5上的ShareKit将文本发布到Facebook

[英]Posting text to facebook using ShareKit on ios 5

I'm updating an existing IOS application that uses ShareKit to share to Facebook and Twitter. 我正在更新使用ShareKit分享到Facebook和Twitter的现有IOS应用程序。 I've integrated ShareKit 2.0 and followed all the instructions. 我已经集成了ShareKit 2.0并遵循了所有说明。 I have no problems sharing to Facebook and Twitter under IOS 6. 我在IOS 6下分享到Facebook和Twitter没有任何问题。

On IOS 5 however, Twitter works fine but Facebook does not. 然而,在IOS 5上,Twitter工作正常,但Facebook没有。 This is the behavior I see: 这是我看到的行为:

  1. I have a button to post text to Facebook. 我有一个按钮将文字发布到Facebook。 When I tap it, it takes me to a safari window to log in to Facebook. 当我点击它时,它会带我到一个野生动物园窗口登录Facebook。
  2. I log in and it takes me to another safari page saying I've already authorized the app. 我登录后,它带我到另一个狩猎页面说我已经授权了应用程序。
  3. I tap the "ok" button in the upper right and it takes me back to my app and overlays a type in window. 我点击右上角的“确定”按钮,它会将我带回我的应用程序并覆盖窗口中的类型。
  4. I type something and tap the "Send to Facebook" button. 我输入内容并点按“发送到Facebook”按钮。
  5. Now it takes me back to the same safari window as in #2. 现在它带我回到与#2相同的safari窗口。 It I tap ok, I am taken back to my app again with an activity indicator saying "Saving to Facebook." 我点击确定,我再次使用活动指示器“保存到Facebook”重新收回我的应用程序。 This indicator spins forever. 这个指标永远旋转。 I also get a crash: 我也遇到了崩溃:

2013-03-25 15:04:57.570 APPNAME[72699:c07] -[__NSCFDictionary setObject:forKeyedSubscript:]: unrecognized selector sent to instance 0xb468f30 2013-03-25 15:04:57.570 APPNAME [72699:c07] - [__ NSCFDictionary setObject:forKeyedSubscript:]:无法识别的选择器发送到实例0xb468f30

2013-03-25 15:04:57.596 APPNAME[72699:c07] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFDictionary setObject:forKeyedSubscript:]: unrecognized selector sent to instance 0xb468f30' 2013-03-25 15:04:57.596 APPNAME [72699:c07] *由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:' - [__ NSCFDictionary setObject:forKeyedSubscript:]:无法识别的选择器发送到实例0xb468f30'

* First throw call stack: *第一次抛出调用堆栈:

(0x6e6022 0x1fbbcd6 0x6e7cbd 0x64ced0 0x64ccb2 0x1e7818 0x1e7396 0x1e2587 0x1c6c00 0x1c6413 0x1dd0aa 0x1db4ad 0x1d7729 0x1e0263 0x1e0999 0x17c6a49 0x17c4e84 0x17c5ea7 0x17c4e3f 0x17c4fc5 0x1709f5a 0x94aa39 0xa17596 0x941120 0xa17117 0x940fbf 0x6ba94f 0x61db43 0x61d424 0x61cd84 0x61cc9b 0x24a87d8 0x24a888a 0xdc3626 0x23b9 0x22f5) terminate called throwing an exception(lldb) (0x6e6022 0x1fbbcd6 0x6e7cbd 0x64ced0 0x64ccb2 0x1e7818 0x1e7396 0x1e2587 0x1c6c00 0x1c6413 0x1dd0aa 0x1db4ad 0x1d7729 0x1e0263 0x1e0999 0x17c6a49 0x17c4e84 0x17c5ea7 0x17c4e3f 0x17c4fc5 0x1709f5a 0x94aa39 0xa17596 0x941120 0xa17117 0x940fbf 0x6ba94f 0x61db43 0x61d424 0x61cd84 0x61cc9b 0x24a87d8 0x24a888a 0xdc3626 0x23b9 0x22f5)终止叫做抛出异常(LLDB)

I've tried turning on debugging but get no help. 我试过打开调试但没有得到帮助。

Any help would be most appreciated! 非常感激任何的帮助!

Cheers, 干杯,

  • Jon 乔恩

I have bumped into similar issue to this in the past, and believe it would have to do with the selector not being added until iOS 6, potentially see this stack exchange thread: 我在过去遇到了类似的问题,并且认为它与选择器没有被添加到iOS 6之前,可能会看到这个堆栈交换线程:

dequeueReusableCellWithIdentifier error in my UITableView in iOS5 在iOS5中的UITableView中出现dequeueReusableCellWithIdentifier错误

You need to implement the following in your AppDelegate 您需要在AppDelegate中实现以下内容

-(BOOL) application:(UIApplication *)application 
            openURL:(NSURL *)url
  sourceApplication:(NSString *)sourceApplication
         annotation:(id)annotation
{
    NSString* scheme = [url scheme];

    if ([scheme hasPrefix:[NSString stringWithFormat:@"fb%@", SHKCONFIG(facebookAppId)]]) {
        return [SHKFacebook handleOpenURL:url];
    }

    return YES;
}

In that case when Safari brings back your app, ShareKit will show dialog to enter share message and you will be able to send it. 在这种情况下,当Safari恢复您的应用程序时,ShareKit将显示对话框以输入共享消息,您将能够发送它。

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

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