gpt4 book ai didi

objective-c - Xcode 7 GM(iOS9) 不支持启动画面动画。应用程序因错误而崩溃

转载 作者:太空狗 更新时间:2023-10-30 03:57:09 26 4
gpt4 key购买 nike

在我的应用程序中,我使用以下代码来显示动画启动画面。应用程序在 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 时收到的错误消息:

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

最佳答案

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

改为

    [window setFrame:[[UIScreen mainScreen] bounds]];

关于objective-c - Xcode 7 GM(iOS9) 不支持启动画面动画。应用程序因错误而崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32538671/

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