GithubHelp home page GithubHelp logo

Comments (15)

yujuan avatar yujuan commented on April 20, 2024

Thanks for your report. We know this issue and the reason is that when the app is restarted, though we had save the correct access token, but the cookie for the webview dialog is not kept. We are working on a way to resolve that. Thanks

from facebook-ios-sdk.

lauraskelton avatar lauraskelton commented on April 20, 2024

OK, well I hope it gets fixed. Here's my workaround method that seems to be working (with the general setup used in the Run Around example) if anyone else is trying to do this-

in viewDidLoad:

_permissions =  [[NSArray arrayWithObjects: 
                  @"publish_stream",@"read_stream",@"offline_access",nil] retain];

_session = [[Session alloc] init];
_facebook = [[_session restore] retain];

if (_facebook == nil) {
    _facebook = [[[[Facebook alloc] init] autorelease] retain];
} else {

    NSData *cookiesdata = [[NSUserDefaults standardUserDefaults] objectForKey:@"FBCookies"];

    NSArray *cookies = [NSKeyedUnarchiver unarchiveObjectWithData:cookiesdata];

    NSHTTPCookie *cookie;
    for (cookie in cookies) {
        [[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookie:cookie];
    }
}

in userInfoDidLoad:

[_session setSessionWithFacebook:_facebook andUid:_userInfo.uid];
[_session save];

NSData *cookiesdata = [NSKeyedArchiver archivedDataWithRootObject:[[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies]];

[[NSUserDefaults standardUserDefaults] setObject:cookiesdata forKey:@"FBCookies"];

from facebook-ios-sdk.

shawnwall avatar shawnwall commented on April 20, 2024

I just ran into this same issue, thanks for the workaround.

edit - couldn't get the workaround working. issue still persists. i may just go back to the facebook-iphone-sdk as it was 100x simpler to use.

from facebook-ios-sdk.

jessearmand avatar jessearmand commented on April 20, 2024

For this issue, it turns out to be much simpler to just store the access token string and expiration date with NSUserDefaults. Then, restore it when we want to use it again by invoking the method in Facebook class isSessionValid.

from facebook-ios-sdk.

yujuan avatar yujuan commented on April 20, 2024

Preserve and reset the cookie is not recommend way. I just make a server side change which will accept a persistent cookie. Now this issue should be resolved.

from facebook-ios-sdk.

lauraskelton avatar lauraskelton commented on April 20, 2024

It still gives me the same error unless I store the cookies in NSUserDefaults along with the access token and expiration date.

from facebook-ios-sdk.

yujuan avatar yujuan commented on April 20, 2024

Can you try theRunAround again and see if this is still the case?

from facebook-ios-sdk.

lauraskelton avatar lauraskelton commented on April 20, 2024

It's still happening in theRunAround. If I log in, post something, then completely quit the app (not just make it in the background in iOS 4), then open the app again and try to post, I get the error "An error occurred with -MyFacebookApp-. Please try again later."

from facebook-ios-sdk.

yujuan avatar yujuan commented on April 20, 2024

You can first try on ios 3.2 by changing the base sdk. For iOs4, if you are using simulator, boot from xcode, it will reinstall the app again and the persistent cookie would not be there. let me know thx.

from facebook-ios-sdk.

lauraskelton avatar lauraskelton commented on April 20, 2024

OK it seems to be working now, thanks!

from facebook-ios-sdk.

yujuan avatar yujuan commented on April 20, 2024

Cool!

from facebook-ios-sdk.

lauraskelton avatar lauraskelton commented on April 20, 2024

I think I spoke too soon- I am using the Simulator so I don't know if this is an issue with the phone as well, but if I log in, quit the simulator (4.0), then start the simulator (not booting from xcode), and open theRunAround app again, I still get the error. I can't test on a phone though to see if you turn the phone off and back on if it would give the error but it's something you might want to check.

from facebook-ios-sdk.

yujuan avatar yujuan commented on April 20, 2024

I use the 4.0 simulator also and did not see this repro.. it works for me. Just in case, I have some minor fix recently, you have been updating for that is that correct? if yes you can also try the app id 230820755197 for the runAround?

from facebook-ios-sdk.

lauraskelton avatar lauraskelton commented on April 20, 2024

I updated the files, and it works for app id 230820755197, but not for the app id for my app... do you know what could be happening? my app id is 115402728275

from facebook-ios-sdk.

lauraskelton avatar lauraskelton commented on April 20, 2024

Well now it looks like it's working again, so hopefully it will stay that way!

from facebook-ios-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.