gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-01 18:47:06 24 4
gpt4 key购买 nike

这是我的实际错误:

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



以前,即使在 IOS 8.4 中,代码也能正常工作。

使用 IOS 9 plus 执行以下代码时会显示此错误:
TabBarVC *newview =[[TabBarVC alloc]initWithNibName:@"TabBarVC" bundle:Nil];                            
self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:[[TabBarVC alloc] init] ];
[self.navController pushViewController:newview animated:YES];

确切地说,我正在尝试使用以前存储的用户 session 重新输入我的应用程序。
[SVProgressHUD showWithStatus:@"Authenticate..." maskType:SVProgressHUDMaskTypeClear];
NSString *success=[WEbServiceManager loginWithEmail2:val Type:@"Normal" SocialId:@"0" Devicetoken:returnAValue];

if ([success intValue]==1) {
[SVProgressHUD dismiss];

[[NSUserDefaults standardUserDefaults] setObject:[val stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] forKey:@"username"];
[[NSUserDefaults standardUserDefaults] setObject:@"Normal" forKey:@"type"];
[[NSUserDefaults standardUserDefaults] synchronize];

isGeneralLogin=@"Normal";
[store setObject:@"TRUE" forKey:@"IsFirstTime"];

strGlobalUserId=userInfo.userId;

NSString *strSpecialChannel= [NSString stringWithFormat:@"Ce_%@",userInfo.userId];

[PFPush subscribeToChannelInBackground:strSpecialChannel block:^(BOOL succeeded, NSError *error) {
if (succeeded) {
NSLog(@"Successfully subscribed to the broadcast channel n.");
} else {
NSLog(@"Failed to subscribe to the broadcast channel .");
}
}];


TabBarVC *newview =[[TabBarVC alloc]initWithNibName:@"TabBarVC" bundle:Nil];
self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:[[TabBarVC alloc] init] ];
[self.navController pushViewController:newview animated:YES];

下面是我第一次用来登录的代码,它很完美。

最佳答案

@Santanu 达斯。
一些事情发生了变化,你需要确保你的 UIWindow 在做任何事情之前已经“ Root ”了一个有效的 Controller ,所以它会是这样的:

rootViewController = [[RootViewController alloc]init];
UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:rootViewController];

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor = [UIColor whiteColor];
[self.window setRootViewController:nav];
[self.window makeKeyAndVisible];

知道了?

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

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