English 中文(简体)
SIGABRT 将对象添加到数组 [封闭]
原标题:SIGABRT when adding objects to array [closed]
Closed. This question needs to be more focused. It is not currently accepting answers.

想要改进这个问题吗? 更新问题,使其只关注一个问题

Closed 10 years ago.

enemyBlobArray = [[NSMutableArray alloc] init];

for(int i = 0; i < kEnemyCount; i++) {
    [enemyArray addObject:[SpriteHelpers setupAnimatedSprite:self.view numFrames:3 withFilePrefix:@"greenbox" withDuration:((CGFloat)(arc4random()%2)/3 + 0.5) ofType:@"png" withValue:0]];
}

enemyView = [enemyArray objectAtIndex:0];

I am trying to make objects appear on screen from this array. I get an error message saying that the object I add cannot be nil. I don t know why it s nil, though.

问题回答

setup AnimatedSprite:numFrames: with FilePrefix: withthDuration:ofType:withType:withValue: is return Negy: is returned new. 方法中存在问题。由于我们没有该方法的代码,我无法告诉你它可能是什么。

根据提供的代码, 您没有提及“ 敌人阵列” 的分配和初始化; 但是, 您创建了一个名为“ 敌人布洛布阵列” 的可变阵列, 这个阵列在提供的代码中从未使用过 。 也许这是一个简单的错误拼写变量名称的问题 。





相关问题
How do you create UIBarButtonItems with a radio interface?

I have a UIToolbar that needs three buttons in a radio style, meaning that of the three, only one button can be pushed at a time. The documentation makes reference to the possibility of setting up ...

iPhone settings bundle

I want to allow the user to enter a valid date using the iPhone’s settings application. I have experimented with many of the PreferenceSpecifiers data node types including date. I have two issues: ...

Circular #import/@class problem in ObjectiveC

I m going to use an example to properly illustrate my confusion. I can t quite wrap my head around this. In Cocoa touch, we have UIViewController and its subclass, UINavigationController. Now, UIVC ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Cocoa-Touch: issue looping MPMoviePlayerController

I have an app which has to load some data at startup, so I want to display a splash-screen animation. I m using the MPMoviePlayerController to play a m4v file. The movie has it s background set to [...

Iphone sequential animation with setAnimationDelay

I m trying to chain animation events. The application I m coding for work has a multiple choice quiz. First you pick your multiple choice answer. The quiz view fades away. Then a label ("correct" or "...

热门标签