gpt4 book ai didi

ios - -[UIApplication _runWithMainScene :transitionContext:completion:], 中的断言失败

转载 作者:技术小花猫 更新时间:2023-10-29 11:02:59 25 4
gpt4 key购买 nike

我仅在 iOS9 中收到以下错误。

这是我的代码:-

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
if ([[NSUserDefaults standardUserDefaults] objectForKey:@"login_dict"])
{
if ([[NSUserDefaults standardUserDefaults] objectForKey:@"isLogout"] == nil || [[[NSUserDefaults standardUserDefaults] objectForKey:@"isLogout"] integerValue]== 0)
{
self.loginDict = [[BaseViewController sharedInstance] removeNullFromDictionary:[[NSUserDefaults standardUserDefaults] objectForKey:@"login_dict"]];
self.firstViewController = [[HomeViewController alloc] initWithNibName:@"HomeViewController" bundle:nil];
}
if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"isLogout"] integerValue]== 1)
{
self.firstViewController = [[WelcomeViewController alloc] initWithNibName:@"WelcomeViewController" bundle:nil];
}
NSLog(@"Userinfo = %@",self.loginDict);
}
else
{
self.firstViewController = [[WelcomeViewController alloc] initWithNibName:@"WelcomeViewController" bundle:nil];
}

self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];

self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
self.navigationController = [[BufferedNavigationController alloc] initWithRootViewController:self.firstViewController];
//[window makeKeyAndVisible];

[self.window setRootViewController:self.navigationController];
}

注意:此代码在 Xcode 6.4 和 iOS8 中运行良好。

 Assertion failure in -[UIApplication _runWithMainScene:transitionContext:completion:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3505.16/UIApplication.m:3294

最佳答案

我不得不从应用程序 didFinishLaunchingWithOptions 中删除这一行:

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

这为我解决了问题。

关于ios - -[UIApplication _runWithMainScene :transitionContext:completion:], 中的断言失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32711397/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com