Sunday 15 May 2011

ios - FBRequest requestForMe does not respond -


I am following sample code on Facebook developer's site and for example I can not bring my name. I am using this code:

  - (zero) viewDidoadload {[Super Viewedload]; // Setup an additional after loading the view AppDelegate * appDelegate = [[UIApplication shared application] representative]; If (delete the App! Session .is open) {nslog ("session is not open"); // Create a fresh session object app Delegate.session = [[FBSession alloc] init]; // If we do not have a cached tonk, due to a call to open here UX will be // to login; We do not want to do this unless the user clicks on the login button, and so // we check here that we get a token before making an open call (appDelegate.session.state == FBSessionStateCreatedTokenLoaded) {// Although we had a cash token, we would need to log in to make the session usable [appDellegate.session openWithCompletionHandler: ^ (FBSession * session, FBSessionState status, NSError * error) {// We update buttons and labels , Here recurs}]; }} And {nslog (@ "session is open"); [[FBCEC Request Formation] Startup ClosingHandler: ^ (FBSEException Connection *, NSDXXA & LT; FBGF User & gt; * User, NSERR * Error) (If (Error!) {NSLog (@ "Login:% @, ID:% @ ", User name, user id);} Else {NSLog (@" error:% @ ", error);}}];}}   

So when the session is open I see this output:

  session is an open error: error domain = com.facebook.sdk code = 5 "operation floods Can not be done. (Com.facebook.sdk Error 5.) "UserInfo = 0x1fd60620 {com.facebook.sdk: ParsedJSONResponseKey = {body = {error = {code = 2500; Message =" Asking information about current user An active access token should be used. "; Type = OAuthException;};}; Code = 400;}, Com.facebook.sdk: HTTPStatusCode = 400}   

Facebook On the App page, I have set AppId to 0 because it has not been uploaded yet. The bundle ID is set correctly.

What am I missing or doing this No other way to do it?

You should call your add delit session as an active session

  [FBSession setActiveSession: appDelegate.session];   

When you open it.

The reason for this is that the requestforford method of the FBCEE uses an active session (as stated in the document).

No comments:

Post a Comment