L'échec d'Assertion dans -[UIApplication _runWithMainScene:transitionContext:achèvement:],
J'obtiens l'erreur suivante dans iOS9 seulement.
Voici mon code:-
- (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];
}
Remarque : Ce code fonctionne très bien dans Xcode 6.4 et iOS8.
Assertion failure in -[UIApplication _runWithMainScene:transitionContext:completion:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3505.16/UIApplication.m:3294
OriginalL'auteur Akash Raghani | 2015-09-22
Vous devez vous connecter pour publier un commentaire.
J'ai dû supprimer cette ligne de l'application didFinishLaunchingWithOptions:
Et qu'il fixe pour moi.
OriginalL'auteur Andrew Smith
ici j'ai eu la solution par vérifier si navigationController est nul ou pas:-
OriginalL'auteur Akash Raghani
À l'aide de cette ligne a résolu mon problème (iOS 10):
A (travaillé pour les anciens iOS et Xcode):
OriginalL'auteur Idan