我在 Xcode 中需要一些帮助。我收到错误 Thread 1: SIGABRT 它指向 main.m 文件。我设置了异常断点,它仍然在 main.m 文件中停止。
#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]));
}
}
那是我在 main.m 文件中的代码。有人可以帮我解决这个错误。
完整的错误是:
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
在我的 game.m 文件中,我有:
-(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];
}
在我的 game.h 文件中,我有:
- (IBAction)pause:(id)sender;
- (IBAction)resume:(id)sender;
-(void)pauseLayer:(CALayer*)layer;
-(void)resumeLayer:(CALayer*)layer;
我需要一些帮助。