react-native-tiktok
react-native-tiktok copied to clipboard
IOS: View is not in the window hierarchy
Hey, thank you for this library!
I'm running into an isssue when trying to use auth
:
Attempt to present <UINavigationController: 0x7fc6458b7c00> on <Tiktok: 0x7fc64526fa80> (from <Tiktok: 0x7fc64526fa80>) whose view is not in the window hierarchy.
React Native: 0.68.2
.
This is my AppDelegate.mm
:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[TikTokOpenSDKApplicationDelegate sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions];
RCTAppSetupPrepareApp(application);
RCTBridge *bridge = [self.reactDelegate createBridgeWithDelegate:self launchOptions:launchOptions];
UIView *rootView = [self.reactDelegate createRootViewWithBridge:bridge moduleName:@"main" initialProperties:nil];
rootView.backgroundColor = [UIColor whiteColor];
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [self.reactDelegate createRootViewController];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
return YES;
}
I've tried forcing the TikTokOpenSDK
version to be 5.0.0
but that didn't help.
Do you have any ideas for what it could be?
@dscottpi unfortunately, I didn't test it on version 0.68+
+1 I have the same issue. Nothing happens when the TikTok app is not installed on an iOS device. In the iOS console, I can see this error: view is not in the window hierarchy.
react native: 0.67.4
Has somebody solved this issue? I'm having the same issue with react native 0.69. Although it's working just fine with some tweaks on android.
On IOS Simulator I get this error but when I build and use on my phone, it opens up TikTok app. So the issue is if you don't have Tiktok installed on your device, then it wants to open a modal which causes this issue. I tried debugging for the past hours and it all leads to TikTok.swift file, I don't know much about Swift so I am kind of stuck here. But I thought of at least help by leading to the issue.
Anything new on this? It works completely fine on my iphone physical device. But that's because I have Tiktok app installed and it isn't trying to open a web view where the user can login to tiktok. So without the Tiktok app installed on your device, you can't use the Tiktok login functionality and you get this error as the title says.
We have solved it with our own logic. We are checking if TikTok is installed and:
- If it is, then we are using react-native-TikTok
- if it's not, then we are redirecting the user to the Safari browser, where the user can log in. After successful login, TikTok calls redirect Url, which is our API, and this API requests the user to open our app.
We have solved it with our own logic. We are checking if TikTok is installed and:
- If it is, then we are using react-native-TikTok
- if it's not, then we are redirecting the user to the Safari browser, where the user can log in. After successful login, TikTok calls redirect Url, which is our API, and this API requests the user to open our app.
Thank you for this!