Lover of Apple
Lover of Apple

Reputation: 11

Thread 1: signal SIGABRT in main.m file

I need some help in Xcode. I am getting the error Thread 1: SIGABRT and it is pointing to the main.m file. I set up the exception breakpoint and it still stops in the main.m file.

#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>

#import "AppDelegate.h"

int main(int argc, char *argv[])
{
    @autoreleasepool {
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
    }
}

That is the code that I have in my main.m file. Can someone please help me with this error.

The full error is:

2013-09-07 23:41:05.440 save the jewel 5[86090:c07] -[game pause:]: unrecognized selector sent to instance 0x845ece0
2013-09-07 23:41:09.460 save the jewel 5[86090:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[game pause:]: unrecognized selector sent to instance 0x845ece0'
*** First throw call stack:
(0x1693012 0x13a0e7e 0x171e4bd 0x1682bbc 0x168294e 0x13b4705 0x2e82c0 0x2e8258 0x3a9021 0x3a957f 0x3a86e8 0x317cef 0x317f02 0x2f5d4a 0x2e7698 0x26f5df9 0x26f5ad0 0x1608bf5 0x1608962 0x1639bb6 0x1638f44 0x1638e1b 0x26f47e3 0x26f4668 0x2e4ffc 0x23c2 0x22f5)
libc++abi.dylib: terminate called throwing an exception

In my game.m file I have:

-(void)pauseLayer:(CALayer*)layer{
    CFTimeInterval pausedTime = [layer convertTime:CACurrentMediaTime() fromLayer:nil];
    layer.speed = 0.0;
    layer.timeOffset = pausedTime;
}

-(void)resumeLayer:(CALayer*)layer{
    CFTimeInterval pausedTime = [layer timeOffset];
    layer.speed = 1.0;
    layer.timeOffset = 0.0;
    layer.beginTime = 0.0;
    CFTimeInterval timeSincePause = [layer convertTime:CACurrentMediaTime() fromLayer:nil] - pausedTime;
    layer.beginTime = timeSincePause;
}


- (IBAction)pause:(id)sender {
    [self pauseLayer:self.view.layer];

}

- (IBAction)resume:(id)sender {
    [self resumeLayer:self.view.layer];
}

In my game.h file I have:

- (IBAction)pause:(id)sender;
- (IBAction)resume:(id)sender;


-(void)pauseLayer:(CALayer*)layer;
-(void)resumeLayer:(CALayer*)layer;

I need some help.

Upvotes: 0

Views: 459

Answers (1)

bbum
bbum

Reputation: 162712

-[game pause:]: unrecognized selector sent to instance 0x845ece0

This means that you have an instance of the game class (which, btw, that class should be Game, not game, classes are capitalized) and something is calling the method pause: on that class, but there is no pause: method.

Given that the class is called Game (fixed) and pausing seems like a reasonable thing to do to a game, it is unlikely that this is an over-release problem. pause: seems like it is something that you might have a button hooked up to in interface builder.

Did you, perchance, rename the pause: method to something else (pauseGame:?) and not fix the connection in IB?


And that pause: implementation is inside the @implementation Game scope? If so, trying cleaning the project and rebuilding as there may be a dependency issue. If not, then that is your problem.

If the build from clean thing doesn't work, then there is some detail missing. Since building from clean didn't work, you'll have to post more details. Show the declaration of the class, at least.

Upvotes: 2

Related Questions