Open ManalLiaquat opened 4 years ago
I am also facing this issue in IOS, but in Android, it works perfectly and return accessToken every time I open the app.
I'm also facing this issue in iOS.
Same issue here. Only way to "fix" it is to kill the app and open it again.
I got same issue, but i solved adding some code in AppDelegate.m
.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
#ifdef FB_SONARKIT_ENABLED
InitializeFlipper(application);
#endif
// add this
[[FBSDKApplicationDelegate sharedInstance] application:application
didFinishLaunchingWithOptions:launchOptions];
// add this
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
moduleName:@"myReactnativeExample"
initialProperties:nil];
rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [UIViewController new];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
return YES;
}
🐛 Bug Report
I want
accessToken
incomponentDidMount
but gettingnull
in the promise response when I restart (not reload) the app. I think that FBSDK login is not persisting the accessToken in the app. This only happens in iOS (Both: real device and simulator) and in Android, it works fine.To Reproduce
AccessToken.getCurrentAccessToken()
after login success (Note: I'm getting accessToken two times)componentDidMount
(I'm gettingnull
even after login)componentDidMount
) but gettingnull
in promise response.Expected Behavior
As I said in the bug report section, that I'm going to get an access token in
componentDidMount
but gettingnull
in the promise response.Code Example
Environment