Jon Schlossberg
Jon Schlossberg

Reputation: 409

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. I've integrated ShareKit 2.0 and followed all the instructions. I have no problems sharing to Facebook and Twitter under IOS 6.

On IOS 5 however, Twitter works fine but Facebook does not. This is the behavior I see:

  1. I have a button to post text to Facebook. When I tap it, it takes me to a safari window to log in to 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.
  5. Now it takes me back to the same safari window as in #2. It I tap ok, I am taken back to my app again with an activity indicator saying "Saving to 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.596 APPNAME[72699:c07] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFDictionary setObject:forKeyedSubscript:]: unrecognized selector sent to instance 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)

I've tried turning on debugging but get no help.

Any help would be most appreciated!

Cheers,

Upvotes: 0

Views: 941

Answers (2)

plamkata__
plamkata__

Reputation: 763

You need to implement the following in your 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.

Upvotes: 1

woody121
woody121

Reputation: 358

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:

dequeueReusableCellWithIdentifier error in my UITableView in iOS5

Upvotes: 1

Related Questions