ideashower / ShareKit

Drop in sharing features for all iPhone and iPad apps
http://getsharekit.com
1.79k stars 375 forks source link

Facebook Sharing No longer works! #234

Closed dzeitman closed 13 years ago

dzeitman commented 13 years ago

Clearly something has changed - all of my existing apps that posted to Facebook now fail.

I've tried this with the latest version of SK and on deployed versions .2x This is a bit frustrating - anyone have a fix?

adeem commented 13 years ago

Same issue for me.

aparle commented 13 years ago

I have same problem. Facebook post fails with same symptoms. Looking for fix. Have 5 apps live with Facebook not working. Thanks Andy

piyushhirpara commented 13 years ago

Same Problem Guyss...Please help me take out from this problem,,,,I have to uplaod an app today but now because of this issue I cant... :(

tobytaro commented 13 years ago

same problem. somebody help!

ideashower commented 13 years ago

A similar issue happened last month: https://github.com/ideashower/ShareKit/issues/207

I'd recommend filing a bug with Facebook. In the previous issue (linked above) there was a Facebook bug you could reference.

dzeitman commented 13 years ago

Thanks, but I'm a bit confused as to who's the owner of the problem since I don't really understand how it all works. Perhaps Facebook retired or updated some url?

In which case then wouldn't the issue be a matter of updating sharekit's urls and letting everyone using sharekit know that there's a issue.

I like many other have quite a few apps that use sharekit - I'm shipping an app later in the day, and frankly not sure how to approach the problem, my app has several places where I connect out to Facebook. It's a bummer that I need to remove that feature and re-call all of my apps.

Up until now, I've never had issues and I've been a big fan of how simple it was to add Facebook and other services to my apps. I really haven't dug into how it actually works.

I guess given Facebook does what Facebook wants to do, perhaps there's an opportunity to use this as an opportunity to show the sharkit community - a deconstruction of how it all works - a quick behind the scenes walkthrough of the service - and explore where to make changes to the urls to fix the issue now and later if Facebook changes it's API again.

I'm more that happy to contribute to the fix, but I just don't have a clear understanding on where to start.

Thanks again for your quick response.

Dan Zeitman

On Wed, May 25, 2011 at 9:14 AM, ideashower < reply@reply.github.com>wrote:

A similar issue happened last month: https://github.com/ideashower/ShareKit/issues/207

I'd recommend filing a bug with Facebook. In the previous issue (linked above) there was a Facebook bug you could reference.

Reply to this email directly or view it on GitHub: https://github.com/ideashower/ShareKit/issues/234#comment_1236207

napoleone1981 commented 13 years ago

Same issue here...

sandisct commented 13 years ago

Hope someone can come out with a solution fast....

dagerydoo commented 13 years ago

I have a patch coming. Here is the fork:

https://github.com/dagerydoo/ShareKit/tree/NewFBConnect

Note, I was running into compile problems with SHKEvernote.m, and you may need to remove it from the list of compiled files.

1root commented 13 years ago

same issue here

napoleone1981 commented 13 years ago

@dagerydoo: we are waiting... :-) Let us know when patch is release. I saw that you pull the request...

dagerydoo commented 13 years ago

Sorry, I posted this in the other thread:

http://dl.dropbox.com/u/7735151/ShareKit.FBConnect.diff.zip

Also, you can pull the code directly from here (everything is now on the master branch):

https://github.com/dagerydoo/ShareKit

I'll update the README with some installation instructions (basically the same, but you need to update the App-Info.plist and AppDelegate).

dagerydoo commented 13 years ago

The README now contains the additional instructions. Let me know if it is any help. Also, beware of SHKEvernote.m — it was generating compiler errors and I ended up disabling it in my project:

https://github.com/dagerydoo/ShareKit

dzeitman commented 13 years ago

Thanks for the update -

Dan

On Wed, May 25, 2011 at 1:04 PM, dagerydoo < reply@reply.github.com>wrote:

The README now contains the additional instructions. Let me know if it is any help. Also, beware of SHKEvernote.m it was generating compiler errors and I ended up disabling it in my project:

https://github.com/dagerydoo/ShareKit

Reply to this email directly or view it on GitHub: https://github.com/ideashower/ShareKit/issues/234#comment_1237946

Dan Zeitman

Founder, FilmFest

Stay Informed and Participate in the Japan Relief Efforts with Japan Connect: Now available in iTunes: goo.gl/IKbQj

Mission:

The mission of FilmFest is to use technology to connect audiences with film festivals and filmmakers. FilmFest: A Festival In Your Pocket

dzeitman commented 13 years ago

Seem to be missing something here - as this doesn't work. is it some arb string or is this supposed to match a fb value elsewhere? Where's the key: SHKFacebookAppID in this plist example?

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" " http://www.apple.com/DTDs/PropertyList-1.0.dtd">

CFBundleURLName CFBundleURLSchemes fb1234

On Wed, May 25, 2011 at 1:04 PM, dagerydoo < reply@reply.github.com>wrote:

The README now contains the additional instructions. Let me know if it is any help. Also, beware of SHKEvernote.m it was generating compiler errors and I ended up disabling it in my project:

https://github.com/dagerydoo/ShareKit

Reply to this email directly or view it on GitHub: https://github.com/ideashower/ShareKit/issues/234#comment_1237946

Dan Zeitman

Founder, FilmFest

Stay Informed and Participate in the Japan Relief Efforts with Japan Connect: Now available in iTunes: goo.gl/IKbQj

Mission:

The mission of FilmFest is to use technology to connect audiences with film festivals and filmmakers. FilmFest: A Festival In Your Pocket

1root commented 13 years ago

http://pastebin.com/ksHfV55y

dagerydoo commented 13 years ago

You should continue using ShareKit as is, but, due to the way that authentication works, the AppDelegate needs to handle incoming URLs (what you are doing in the Info.plist is telling iOS that your app handles urls with the scheme fbXXXX).

In other words, the AppDelegate has a hook to deal with this, and it needs to be used. If there was a notification or some other mechanism, believe me, I would have implemented it that way.

1root commented 13 years ago

All you do is follow dagerydoo's readme file.. delete your current Facebook folder, replace it with the one he links to above, add the necessary string fbappidher to info.plist and your good to go. I just tested it and it works great.

Make sure you add the app id string to the SHKConfig file :)

Thank you dagerydoo

dagerydoo commented 13 years ago

Now, I am just a simple guy who is happy to help, so save your thanks for someone else.

dzeitman commented 13 years ago

So- I'm a bit confused, this now launches safari - That's not the experience I was expecting.

Thoughts?

Sent from my iPhone

On May 25, 2011, at 5:14 PM, dagerydooreply@reply.github.com wrote:

Now, I am just a simple guy who is happy to help, so save your thanks for someone else.

Reply to this email directly or view it on GitHub: https://github.com/ideashower/ShareKit/issues/234#comment_1238771

1root commented 13 years ago

I know it's weird as shit.. but if you go with it.. log in.. that string you added in your info.plist and that code you entered into your AppDelegate will open your App Again after your authorized. Then tap the share button.. yet again and it will just post to Facebook automatically. Hope this helps.

dagerydoo commented 13 years ago

That is the new FBConnect system: it is a means of allowing users to securely and confidently enter their login credentials. The gist is that after they log in and approve your app, they are redirected to a URL that magically opens your app back up with fairy dust sprinkles and an access token. Your app can then use the access token (until it expires) to post things to facebook.

Let me mitigate your discomfiture: if the user has the native FB app installed, they are redirected there instead, and it all seems a bit more natural.

One thing I can say for sure: this is the way things will be moving forward, and it wouldn't surprise me if more and more sharing networks adopt this mechanism.

steprazor commented 13 years ago

Think I'm gonna wait it out to see if it fixes itself again.. At least for a day or so.. But thanks 1root!

1root commented 13 years ago

@steprazor no worries. It's really easy to implement if you take the time. The user will only have to authorize once and they are good to go :)

jayrparro commented 13 years ago

@dagerydoo @1root: I've tested the propose fixed downloaded the dagerydoo sample project. I'm also a bit of confused.. It launches the safari, I log-in & allow acces..and after that it prompts me for this alert msg.. http://bit.ly/lyo3OP It tries to connect at this URL: http://www.facebook.com/connect/uiserver.php

So, wondering how you can share/post to FB? trying to run again the app still the same process, switches launch to safari, etc.. Anyway, thanks for the help on this.

1root commented 13 years ago

The alert message is telling you that you don't have your application properly configured. Your 1/2 way there.

Ensure that your AppDelegate has the code that is mentioned above to handle the return from facebook back to your application. Also ensure your info.plist is setup properly and has fb200202 or whatever or app id is included not just the number.

jayrparro commented 13 years ago

1root, actually I'm just using the sample test project accompanied in dagerydoo..build it in xcode 4, configure the App ID, check the AppDelegate code & info.plist...all check..didn't make it work for me..bump!

Just one thing I observed. Is the FB App need to submit first in the App Directory before your can use/test it?

1root commented 13 years ago

no. I had to uncomment a few lines of evernote code.. other than that I did everything you described.

jayrparro commented 13 years ago

yeah, I confirmed that the evernote codes got compilation errors... So, after digging the new Facebook-ios library, after a couple of switching safari-to-myApp, I've understand the fix..yeah, it works on me! :)

What I'm just confused for now is that in info.plist, where is it define FACEBOOK_APP_ID ?? coz I'm wondering there's a string concatenation on it...

CFBundleURLSchemes
        <array>
            <string>fb${FACEBOOK_APP_ID}</string>
        </array>

Currently, I'm putting this as direct value like fb12345 in the info.plist Thanks

wimdenood commented 13 years ago

Hi there! It works for me. Just as described in the Readme. However one problem: If I try to post an image this way to facebook, I get the safari with login and after that it returns to my app. But then the image is NOT posted. When I after that post it again, I don't have to login again (previous login was still valid) and then the image IS posted.

Any idea how to fix this??

Thanks a lot for the update!!

M0rph3v5 commented 13 years ago

Is there a way to force the old mode? It's possible with the android facebook sdk i believe.

nestorlafon commented 13 years ago

So it looks like now the app needs to be put in background to authenticate fbconnect... what is going to happen to apps in iOS 3 or iOS 4 in iPod 2nd generation? Those don't have multitasking.

Thallius commented 13 years ago

I have solved the problem of not sending an image first time you habe to enter the login by calling my function which enters the ShareKit actionsheet in the AppDelegate callback

So when your App comes in foreground the ShareKit actionsheet is visible to the user and he can just tap facebook again. Its not a perfect solution. Better way would be to directly call the FB functions in Sharekit but i dont know if there is a compatible way.

dzeitman commented 13 years ago

Thanks to all for jumping into this dilemma - Here's the real problem - the "experience" is really bad. Take my app for instance - the old way - user gets a login screen and then that's replaced with the post or if it's posting a photo - it just works. The experience is via a modal dialog, it's clean and specific to the context of the app - in my case people are doing a posting about a specific film.
This new system means the user is pulled out of the app to safari (or presumably the FB app) and then redirected back to the app - only 4.0 users will return to the same position in the app - < 4 users are dumped out of the app and their place and context is lost. A more complicated URL scheme would be needed to return users to the same position.

Apple doesn't manage the URL scheme namespaces, so the reality is this WILL be a problem long term. If two apps use the same URL scheme, then it's arbitrary on which app will be opened.

Sending people to Facebook to authenticate outside of the app is just a ridiculous idea and defeats the entire purpose of creating a seamless sharing experience via ShareKit. The whole idea of using a native ios sdk and library is to avoid webkit and safari. Frankly this blows.

Is there any way to engineer this to work within the same app?

Anyone out there have any pull with Facebook? They need to know the direction is bad and doesn't really enhance security at the end of the day. Also, what's to prevent them (Facebook) from placing advertising or doings some sort of pre-login / user credential phishing with this new system. The very concept of a webservice API, is to allow developers the opportunity to build and engage users with their own UX, while having the support of the webservices. Authentication UX is just as important as the service itself. The old way was sufficient, and when you consider Apple's own TOS and review system effectively limits exploits on that platform, the change is unwarranted solely in the "name" of security.

More over, the real frustration comes from the fact that countless developers have been caught with their pants down - having to rush out changes to existing apps because of the lack of backwards compatibility.

Not meaning to rant on, just thinking I can't be alone in this frustrating experience. In the end our users loose out.

dagerydoo commented 13 years ago

The new solution works for apps/devices that don't support multitasking.

I'll look into the issue with images — it is likely my bug, or at least something I can work around.

@dzeitman — I hear you about the diminished experience, but I disagree about security not being enhanced. Furthermore, once every app has this same experience (and, in time, they will), users will come to expect it, and ignore its annoyances. Personally, I am lucky that my app (non-multitasking) was already storing state on dismissal and placing the user back in the correct context upon regaining the foreground, so this change didn't result in a terrible amount of additional work (aside from having to update the FB ShareKit service, which I must admit I had not anticipated when I first arrived at getsharekit.com late last week — in fact, had you told me that in order to use this library, one must rewrite a service, I likely would have told you to slag off).

dagerydoo commented 13 years ago

The master branch has been updated to support image posting during the initial authorization:

https://github.com/dagerydoo/ShareKit

Thallius commented 13 years ago

If i did not do something wrong there is no change. It still returns to my App without sending the image.

spiderguy84 commented 13 years ago

I compiled everything from the most recent changes, and got the following errors ShareKit/Sharers/Services/Evernote/SHKEvernote.m:97: error: 'SHKEvernoteUserStoreURL' undeclared (first use in this function) ShareKit/Sharers/Services/Evernote/SHKEvernote.m:111: error: 'SHKEvernoteConsumerKey' undeclared (first use in this function) ShareKit/Sharers/Services/Evernote/SHKEvernote.m:111: error: 'SHKEvernoteSecretKey' undeclared (first use in this function) ShareKit/Sharers/Services/Evernote/SHKEvernote.m:184: error: 'SHKEvernoteNetStoreURLBase' undeclared (first use in this function)

Also, I noticed there is no longer a place for the secret key on facebook api. Is the Facebook appid now the only thing I will need for this?

Also, I use the same sharekit for a few different apps. Some work just fine, others pull in the mobile webview of my facebook. Any idea why this may be?

dagerydoo commented 13 years ago

Can you verify that the top of your SHKFacebook.m looks like so:

@interface SHKFacebook()
+ (Facebook*)facebook;
+ (void)flushAccessToken;
+ (NSString *)storedImagePath:(UIImage*)image;
+ (UIImage*)storedImage:(NSString*)imagePath;
@end
Thallius commented 13 years ago

hm ok it looks different. Ill check the files once again

Sorry my fault. Because of the nearly 1000 different versions in the last days, i put the files in the wrong directory. Everything fine now.

thanks a lot

julianfe commented 13 years ago

Anyone else getting an error on the FB connect page when loaded in Safari?

"error on line 13 at column 35: xmlParseEntityRef: no name"

spiderguy84 commented 13 years ago

Got the issues fixed, but now the icon used for Facebook Connect is something of an address bar instead of what I have uploaded for the icon on my developer page of facebook.

tobytaro commented 13 years ago

I can return from facebook to my app, but when I enter facebook, I get this error. why? http://img.ly/4raZ

"error on line 13 at column 35: xmlParseEntityRef: no name"

dagerydoo commented 13 years ago

@spiderguy84 to deal with that, in my app, I did something like this:

SHKItem *item = [SHKItem URL:url title:shareTitle];
[item setCustomValue:kMyAppThumbnailURL forKey:@"picture"];

Where kMyAppThumbnailURL is something like https://www.facebook.com/[your app's icon reference]

dagerydoo commented 13 years ago

Not sure about the XML errors, I'm not seeing them. Are you certain everything has been configured properly?

julianfe commented 13 years ago

Reported bug http://bugs.developers.facebook.net/show_bug.cgi?id=17871 Vote it up!

julianfe commented 13 years ago

The xmlparse bug also occurs when the Facebook application is installed, first you get the log-in screen, followed by the failing page.

If the Facebook App is deleted, requesting log-in via Sharekit launches Safari https://m.facebook.com/dialog/oauth?type=user_agent&display=touch&redirect_uri=fb1234%3A%2F%2Fauthorize&sdk=2&scope=publish_stream%2Coffline_access&client_id=1234

Page says "An eror occurred. Please try again later"

1root commented 13 years ago

fb1234 is your app id @julianfe?

julianfe commented 13 years ago

Just tried both

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<string>fb${FACEBOOK_APP_ID}</string>
</plist>

and

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<string>fb1234</string>
</plist>

Both fail : (

The page it fails to load is https://m.facebook.com/dialog/oauth?type=user_agent&display=touch&redirect_uri=fb1234%3A%2F%2Fauthorize&sdk=2&scope=publish_stream%2Coffline_access&client_id=1234

1root commented 13 years ago

You need to replace fb123 with your fbAppId... so yours should look nothing like the ones you just pasted. It should be unique to you and you alone.