在我的应用程序中,我使用下面的代码来显示动画启动屏幕。应用程序在Xcode-6.4(iOS 8)中工作正常,但到了Xcode-7GM版本(iOS9)应用程序出现错误而崩溃。
window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
imageArray = [[NSMutableArray alloc] initWithCapacity:IMAGE_COUNT];
// Build array of images, cycling through image names
for (int i = 1; i <= IMAGE_COUNT; i++)
[imageArray addObject:[UIImage imageNamed:
[NSString stringWithFormat:@"image__%d.png",i]]];
animationImageView = [[UIImageView alloc] initWithFrame:self.window.bounds];
animationImageView .animationImages=[NSArray arrayWithArray:imageArray];
// One cycle through all the images takes 3.5 seconds
animationImageView .animationDuration = 3.5;
// Repeat forever
animationImageView .animationRepeatCount = 0;
// Add subview and make window visible
[window addSubview:animationImageView ];
[window makeKeyAndVisible];
// Start it up animations
[animationImageView startAnimating];
// Wait 3.5 seconds, then stop animation
[self performSelector:@selector(stopAnimation) withObject:nil afterDelay:3.5];`
这是我在使用Xcode-7GM时得到的错误信息:
断言失败在-[UIApplication ._runWithMainScene: transitionContext:完成),/BuildRoot/图书馆/缓存/com.apple.xbs/资源/UIKit_Sim/uikit - 3505.16/UIApplication.m: 3294
window = [[UIWindow alloc] initWithFrame:[[uisscreen mainScreen] bounds]];之前改为
<>之前[window setFrame:[[UIScreen mainScreen] bounds]];
听起来你在尝试建立一些网络。在iOS 9中,默认情况下,所有网络通信都必须是安全的。如果您尝试执行http:
请求,它将失败;您必须使用https:
(除非您在Info.plist中将此功能关闭)。
我也有同样的问题,它已经通过删除[window makeKeyAndVisible];解决了。
self窗口需要在didFinishLaunchingWithOptions::
中设置为根视图控制器(自我。窗口setRootViewController: navController];
对于我来说,像jonmo,这个错误是在退出didFinishLaunchingWithOptions之前没有定义rootViewController的结果。
为我解决了这个问题。
在Xcode 7之前,它只是一个警告,现在它似乎是一个硬停止
在我的情况下,这个错误消息的解决方案是更新一个包含的CocoaPods依赖名为环回(我相信增加了一个额外的UIWindow到应用程序)
我也有同样的问题,它已经通过替换Appdelegate.m
[window addSubview:viewController.view];
[window setRootViewController:viewController];