0

2 つの異なる起動イメージを含む Images.xcasset があります。

LaunchImage と LaunchImage2。[Launch Images Source] で [Launch Images] を選択します。

次に、didFinishLaunchingWithOptions 内の AppDelegate に次のコードがあります。

splashView= [[UIImageView alloc] initWithFrame:([[UIScreen mainScreen] bounds])];

    NSMutableArray *images = [[NSMutableArray alloc] init];

    [images addObject:[UIImage imageNamed:@"LaunchImage"]];
    [images addObject:[UIImage imageNamed:@"LaunchImage2"]];

    [self.window addSubview:splashView];
    [self.window bringSubviewToFront:splashView];
    splashView.animationImages = images;
    splashView.animationDuration = 2;
    splashView.animationRepeatCount = 1;
    [splashView startAnimating];

これにより、 LaunchImage2 を取得しようとするとエラーが発生します。バンドルにコピーされていないためだと思います。xcasset 内にあるすべての画像をコピーする必要はありませんか?

私が得ているエラーは次のとおりです。

* キャッチされない例外 'NSInvalidArgumentException' が原因でアプリを終了します。理由: '* -[__NSArrayM insertObject:atIndex:]: オブジェクトを nil にすることはできません'

4

0 に答える 0