Having trouble getting facebook sample to work - the one called "Feed Dialog". - iphone

Does anyone have a working xcode project they could upload / share?
I'm having trouble getting this to work clean without errors.
The example is located here.
[https://developers.facebook.com/docs/howtos/feed-dialog-using-ios-sdk/][1]
I have the project working to this extent -
The main viewcontroller is displayed with a button that allows the user to send a post to facebook.
When clicked, facebook indicates that the user has already authorized the app to post to their page. He clicks OK on the facebook message and then the user sees the 'share' dialog and is allowed to enter text for his post.
As the sharedialog is presented to the user, I get this warning in my console
2012-09-29 11:04:25.190 gw_fakeapp[8016:fe03] FBConditionalLog: handleOpenURL should not be called once a session has closed
My problem comes when the user clicks "share", I get the error:
2012-09-29 11:04:32.217 gw_fakeapp[8016:fe03] *** Terminating app due to uncaught exception 'com.facebook.sdk:InvalidOperationException', reason: 'FBSession: an attempt was made reauthorize permissions on an unopened session'
*** First throw call stack:
(0x14c9022 0xfe2cd6 0x14c8ee1 0x171d1 0x14367 0x3ad8 0x14cae99 0x14814e 0x386a0e 0x14cae99 0x14814e 0x1480e6 0x1eeade 0x1eefa7 0x1ee266 0x16d3c0 0x16d5e6 0x153dc4 0x147634 0x1da9ef5 0x149d195 0x1401ff2 0x14008da 0x13ffd84 0x13ffc9b 0x1da87d8 0x1da888a 0x145626 0x28ed 0x2815)
terminate called throwing an exception(lldb)
Does anyone have a working project I could compare mine with?
Thank you!
Phil

You can download sample of codes from developer.apple.com which describe about Facebook post publishing.
Here is the link: https://github.com/downloads/facebook/facebook-ios-sdk/FacebookSDK-3.1.pkg

Related

knpuniversity oauth2client expected state is null often

vendor/knpuniversity/oauth2-client-bundle/src/Client/OAuth2Client.php:
When I logout user and try to login with facebook again, often I get this exception - InvalidStateException. "User see Invalid state parameter passed in callback URL." Thats because there is no data in session. But why that can happen?
Using this bundle:
https://github.com/knpuniversity/oauth2-client-bundle
This is called from my facebook authenticator class:
public function getCredentials(Request $request)
{
// this method is only called if supports() returns true
return $this->fetchAccessToken($this->getFacebookClient());
}
Also noticed if I try again to login with facebook after this exception, then it logs in succesfully. But later noticed this is also not always the case.
I am thinking there is soemthing to do with race condition somewhere, because when I use xdebug and code stops at breakpoinst, it often workse ok.
The problem was chrome sending 2 requests because of prefetching.
https://www.keycdn.com/support/prefetching
When I enter url in address bar (for testing I had not made facebook button yet) chrome instantly loads it. Then I press enter and it loads it again. And things start happing what is unexpected when there are 2 requests to login with facebook.
Tested on firefox, there is no such problem. When I have made link to login to facebook and so I dont have to type in address bar, it also does not make prefetch and problem is gone on chrome also.

Invoking error handler due to Uncaught abort(59) at Error. How can I solve this?

So I am trying to create a Unity game for WebGl. In this game I need auth0 for the authentication part.
This is the code for the authentication part:
var client = new AuthenticationApiClient(new System.Uri("..."));
var authorizationUrl = client.BuildAuthorizationUrl()
.WithResponseType(AuthorizationResponseType.IdToken, AuthorizationResponseType.Token)
.WithClient("...")
.WithConnection("...")
.WithAudience("...")
.WithRedirectUrl("...")
.Build();
Application.OpenURL(authorizationUrl.AbsolutePath);
To make my page work I have a local server in XAMPP.
So the idea with this is that I need to click a button on the game redirect the page to an Auth0 authentication page and once I enter my username and password (for example gmail account) I go to the game again.
The problem is that whenever I click in this button, I get this error:
Invoking error handler due to
Uncaught abort(59) at Error
at jsStackTrace (htdocs.wasm.framework.unityweb:8:22295)
at stackTrace [Object.stackTrace] (htdocs.wasm.framework.unityweb:8:22466)
at Object.onAbort (http://localhost/Build/UnityLoader.js:4:11047)
at abort (htdocs.wasm.framework.unityweb:8:484763)
at wasm-function[56208]:3
at wasm-function[16961]:46
at wasm-function[43219]:1456
at wasm-function[56097]:16
at dynCall_iii [Object.dynCall_iii] (htdocs.wasm.framework.unityweb:8:459875)
at invoke_iii (htdocs.wasm.framework.unityweb:8:339724)
at wasm-function[43216]:388
at wasm-function[43215]:75
at wasm-function[43213]:99
at wasm-function[43212]:7
at wasm-function[43531]:69
at wasm-function[43530]:7
at wasm-function[28791]:330
at wasm-function[16681]:48
at wasm-function[23219]:1236
at wasm-function[16681]:48
at wasm-function[23267]:1090
at wasm-function[28454]:534
at wasm-function[48795]:330
at wasm-function[23210]:101
at wasm-function[22913]:152
at wasm-function[28604]:71
at wasm-function[28603]:128
at wasm-function[23091]:1169
at wasm-function[22398]:52
at wasm-function[22915]:11
at wasm-function[56135]:22
at dynCall_viiiii [Object.dynCall_viiiii]
And there is more from where this came from. I tried to solve this by searching for that error in google but failed. Any suggestions?

strange error with Facebook Feed dialog

We followed the Facebook example code, shown here -- this works in our app -- if you click the anchor 'a' link, its onclick handler opens a new window and the facebook feed dialog appears:
<a class="fbShareToWall" onClick='window.open("https://www.facebook.com/dialog/feed?app_id=123050457758177
&link=https://developers.facebook.com/docs/reference/dialogs/
&picture=http://fbrell.com/f8.jpg
&name=Facebook%20Dialogs&caption=Reference%20Documentation
&description=Using%20Dialogs%20to%20interact%20with%20users.
&redirect_uri=http://www.example.com/response");'>Share on Facebook</a>
The above code works fine and displays the Facebook sample of the Feed dialog.
Here is our code - we get the error message:
"An error occurred with oursite.com. Please try again later.
API Error Code: 191
API Error Description: The specified URL is not owned by the application
Error Message: redirect_uri is not owned by the application.
NOTE: this is a beta site and we're running it on a staging server whose domain name is NOT the same as the domain name that "OUR_APP_ID" below is associated with:
<a class="fbShareToWall" onClick='window.open("https://www.facebook.com/dialog/feed?app_id="OUR_APP_ID"
&link=https://www.oursite.com&name=Please%20work
&caption=Just%20work
&description=Comeon%20work
&redirect_uri=http://www.oursite.com");'>Share on Facebook</a>
(note: our code has the numerical FB app_id, not "OUR_APP_ID")
"OUR_APP_ID" is 'connected' to our production server's domain name and we're kinda wondering if that's the problem.
EDIT: "we're kinda wondering if that's the problem" because the code above is on our staging website www.foo.com --
and our code above uses an app_Id that we connected to our production domain name 'www.oursite.com'.
We wonder if Facebook -- upon receiving the above request to display the Feed dialog -- is saying to itself
"okay this website www.foo.com is trying to display a Feed dialog -- but the app_id is for www.oursite.com --
so we're going to pop up a 191 error"
We tested that theory. We altered the sample FB feed dialog code at the top -- we changed some numbers in the sample code's app id.
And we get an error message now with the formerly working sample Feed dialog code but it is a completely different error message.
Any advice on this '191' redirect_uri error message?
the url format works fine with my app
https://www.facebook.com/dialog/feed?app_id=135669679827333&link=https://anotherfeed.com&name=testing&caption=Just%20testing&description=the%20test&redirect_uri=http://anotherfeed.com
check to make sure your app id is correct and that your redirecting to the domain that is set up in your app settings.

FBConnect Issues: Authentication and post won't work the first time

I've two issues with Facebook Connect:
1) I use the new Single Sign On Authentication. It works great, but the first time, I authenticate an user with my App when I request the token, i immediately want to post a link to the users wall, but then I get this error:
2011-10-11 15:42:44.831 [1717:707] Dialog DidFail With Error: Error Domain=NSURLErrorDomain Code=-999 "The operation couldn’t be completed. (NSURLErrorDomain error -999.)" UserInfo=0x7487290 {NSErrorFailingURLKey=https://m.facebook.com/dialog/feed?link=http%3A%2F%2Fwww.example.it%2Findex.php%3Fid%3D4%26no_cache%3D1%26tx_ttnews%5Btt_news%5D%3D103184&access_token=_test-Z0Ru37mpEAbffAn9n5wlWUaIVOH2tsF8.eyJpdiI6IjYyUXVBOTJKZVVwWjF5bmxZUmluUGcifQ.VxaUq2QcPXUgcYTjvqtnhLcBK27wflAIv3XoNVNcRT6dtQqfJZZ9NdLqLXxPdpBFl1U1DGF8xetLy8TOcLuLmU9l2AQ0JzYKmm9d-7azAYCYiZc51BiXKgHlpzw9Hsplr-tTKAfkXF2oJSOkbeN7UDMyLqDdCyhwiFTdVX3tGzA&app_id=1535027294&redirect_uri=fbconnect%3A%2F%2Fsuccess&user_message_prompt=Teilen&sdk=2&display=touch, NSErrorFailingURLStringKey=https://m.facebook.com/dialog/feed?link=http%3A%2F%2Fwww.example.it%2Findex.php%3Fid%3D4%26no_cache%3D1%26tx_ttnews%5Btt_news%5D%3D103184&access_token=_Wtest_modifiedF8.eyJpdiI6IjYyUXVBOTJKZVVwWjF5bmxZUmluUGcifQ.VxaUq2QcPXUgcYTjvqtnhLcBK27wflAIv3XoNVNcRT6dtQqfJZZ9NdLqLXxPdpBFl1U1DGF8xetLy8TOcLuLmU9l2AQ0JzYKmm9d-7azAYCYiZc51BiXKgHlpzw9Hsplr-tTKAfkXF2oJSOkbeN7UDMyLqDdCyhwiFTdVX3tGzA&app_id=688535027294&redirect_uri=fbconnect%3A%2F%2Fsuccess&user_message_prompt=Teilen&sdk=2&display=touch}
The second time I try to post something to the wall I get a success, there I don't need to request the permissions again. But the first time it always fauls. With the facebook.app installed, but also with the redirect from Safari.
I only requested "stream_publish", when requesting also "offline_access" then it works. Seems to be a Facebook issue.
We are seeing the same thing over on First dialog after authenticating fails immediately and closes dialog
I know yours was first, but the discussion ended up over on that question.

iphone twitter and sharing

Has anyone encountered the following error message when sending to Twitter?
"Error: Incorrect signature"
And on the debug console:
<0xf14cf80 SHKTwitter.m:(356)> Twitter Send Status Error: {"request":"\/1\/statuses\/update.json","error":"Incorrect signature"}
So far as I can tell I've followed the install instructions on http://www.getsharekit.com/install/#download and it is working with Facebook, e-mail etc. just not Twitter.
It would be great if someone has seen this error before and goes "aha!".
All I did to enable twitter Sharing is:
Regitered my App as a Twitter APP (Application Type: Browser)
#define SHKTwitterConsumerKey #"My..."
#define SHKTwitterSecret #"My..."
#define SHKTwitterCallbackUrl #"http://www.anything.com/callback" // You need to set this if using OAuth, see note above (xAuth users can skip it)
\#define SHKTwitterUseXAuth 0 // To use xAuth, set to 1
\#define SHKTwitterUsername #"" // Enter your app's twitter account if you'dlike to ask the user to follow it when logging in. (Only for xAuth)
Note that for the callback function you can enter any URL you want. even www.google.com. Just make sure it is the same URL in your code.
The issue is that you're signed into your twitter account, and allowed the app to connect to your profile.
However, days go by, the Key and Secret change, and now you're seeing this error. It's because you have to log out and re-log back into Twitter. I spent waaay too much time finding this out when I created a new Twitter App to hook into (and organize my apps) and found this error.
Basically, ShareKit is saving your login info, auto-logging you in, and getting the error when twitter says the app doesn't have permission to connect to your profile.
Follow these steps to log yourself out and test again :
http://www.getsharekit.com/docs/#logout
Check this previous SO question, it might be able to help you solve the problem:
Twitter API status update always returns "Incorrect signature"