fbdialog unable to close - iphone

I am using the iOS static library project provided by Facebook developers for showing the screen, since there is a session timeout scenario, i have to close the screens when it is 15 mins. when user tries to share the post and if he just leaves it for 15 mins i am not able to close his view instead it just comes like a background after my piece of code which closes all the view (except the fbdialog). the problem is that i don't create fbdialog myself, instead i try that
facebook = [[Facebook alloc] initWithAppId:facebookAppId andDelegate:self] ;
the Facebook class creates the dialog and manages by itself, what has to be done to close the dialog whenever i want from my app to the static library.

In your facebook sdk there must be the methods to close the dialog.
You have to use the delegates it provides in order to send messages to that methods.
Find and implement them in your working class.
It must be something like FBDelegate or FBDialogDelegate, I am not sure, you could share a link to your facebook sdk to see it.
I have worked with several FB sdks and they all ware different.

Related

Is it possible to deep link to a Facebook Event page?

I've tried fb://event/EventID#Here which attempts to open the event page in the Facebook app, but then says "Unable to load event. It may have been cancelled." Obviously I didn't cancel the event, and it isn't Private or Guest View only. Is this function simply not supported in iOS 10?
If not, what Facebook deep links are supported? I've only had success with Profiles and Pages, but this post has quite a large list that supposedly work: What are all the custom URL schemes supported by the Facebook iPhone app? (hasn't been updated for iOS 10 though)
fb://event?id=[eventID] appears to work
deeplinks are supported now, your link should be https://facebook.com/events/:eventId/
For me, #Wes answer did not work. Only seems to run with fb://event/:eventId
Maybe the API changed...

Changing Facebook URL from inside the canvas app

I am building a one page Facebook Canvas App using the JS SDK.
Navigation inside the app does not require a new full HTTP request, so I wonder how can I change the "main" facebook URL (http://apps.facebook.com/my_app/[URL]).
All I've been able to do to change the browser URL is call
parent.location.href = 'http://apps.facebook.com/my_app/[SOME_URL]'
but this of course reloads the entire page, and it's not exactly what I want to do. I see lots of unanswered questions about this, is there a JS SDK trick or something like that, since all history/location access from inside the app frame is prohibited for security, or it's just something we'll never be able to do?

Customize the sharekit for iphone

I want to customize the Facebook share button functionality and want to push a new viewController as soon as user share or post on the wall using iphone. I know it is possible, we need to write just 2 or 3 line of code of javaScript but not getting the code. I am using Sharekit in my app. anyone know how to do this?
Thanks
You can detect the post send or shared on user's wall by FBDialogDelegate methods. In your project Expand Sharekit > Sharers > Services > Facebook > SHKFacebook.m and find the method
- (void)dialogDidSucceed:(FBDialog*)dialog
This method will call when user post or share on wall.
You can listen to notifications, which are issued by default during ShareKit workflow. The benefit is, that you do not need to change ShareKit's code.
For preview of notifications sent by ShareKit, look at SHKSharer.m, delegate notification section.
The notifications to listen to are for example
#"SHKSendDidStartNotification"
or
#"SHKSendDidFinish"
etc.

How do I get back to the iPhone web app after having logged in with Facebook Connect?

I have a mobile web site built using jQuery Mobile. I often run it in full screen/mobile web app mode on my iPhone (I have added the web app to my iPhone home screen).
On one of the pages, the user is required to log in to Facebook using the Facebook Connect JavaScript API. If the user is not already logged in, this is done by clicking a login button. The event handler for this button looks like this:
("#fbLogin").click(function () {
FB.login(handleStatusChange(response),
{ scope: "publish_stream",
connect_display: "touch" });
});
In the above code I have inserted some line breaks for better readability, but the values are like in the example. The callback function (handleStatusChange) takes care of the response from the login request.
When I click this, the Facebook login page is opened in my web app window. If I haven't already accepted the Facebook App, I have to give it permissions as well. All this seems to work fine. But after I have given permissions/logged in I'm left hanging on a totally blank screen.
I have also tried another approach to logging in, by putting this inside the login button event handler:
window.location = "https://www.facebook.com/login.php
?api_key=MY_API_KEY
&cancel_url=http%3A%2F%2Fwww.mywebsiteurl.com%3A8081
&fbconnect=1
&next=http%3A%2F%2Fwww.mywebsiteurl.com%3A8081
&return_session=1
&session_version=3
&v=1.0
&req_perms=publish_stream
&connect_display=touch";
Again, line breaks have been inserted for better readability. When used it's just one long string.
The URL used in the cancel_url and next parameters is the one I have registered with the Facebook Application. If I try using a different URL (like http://www.google.com) I get an error so the this seems to be correct. As you can see I use a different port on my development server (port 8081). Could this be a problem?
The result is similar to the previous example. I get the login/permissions pages but I'm left with a blank screen after everything is done. I tried this after reading this post on the old Facebook Developer forum.
If I, on the other hand, try running this in Safari (not as a full page iPhone web app) the login works great.
Is there anything else I can try? Does anyone have a JavaScript API Facebook Connect login working while running in full screen/web app mode on an iPhone?
Thanks in advance!
Not sure if this helps you, but I found that adding the iOS Safari link fix, also allowed Facebook login to work in my fullscreen web app without opening up the page i "regular" Safari:
// Make links work in iOS fullscreen web app
function disableSafariLinks() {
$("a").click(function (event) {
event.preventDefault();
window.location = $(this).attr("href");
});
}
See also iPhone Safari Web App opens links in new window

ShareKit programmatically click "publish"

EDIT: It should be noted that I stated in my original question that I was able to get this working for Twitter (I used the referenced question/answer to get that working) . . . I just needed the answer for how to do it with Facebook. I haven't found an equivalent way to do this with Facebook.
I'm using ShareKit to allow my users to share data from my App with Facebook and Twitter.
I'm having a particular issue with Facebook sharing.
My App is almost completely voice controlled, so upon a voice command I call:
// Create the item to share (in this example, a url)
SHKItem *item = [SHKItem URL:#"http://someurl.com" title:#"some title"];
// Share the item
[SHKFacebook shareItem:item];
This works fine, except the user is presented with a dialog (I think a UIWebView) that allows them to edit the post and either cancel or publish.
Since the App is voice controlled, I want to skip this step, basically programmatically click "publish" for them (call the publish method programmatically). I don't mind if that dialog appears briefly and then goes away (this is how I handle Twitter, I was able to figure out how to do this with Twitter). I'm having no luck finding this publish method though - I assume this is because it is a server side call handled by FBConnect.
Any ideas on a) what code to use to do this, and b) where to put that code)?
Many thanks in advance.
Ben