Objective c 西格伯特不知从哪里冒出来的
我不熟悉用Objective C编程,甚至对编程这类东西也不熟悉。 我正在做一个小而简单的乒乓球游戏,当我试图为电脑播放器制作一个AI时,程序总是“关闭”,显示线程1中的SIGABRT错误 我已经在这里问过这个问题,但没有真正得到答案,只是被要求提供更多的代码 这个错误真的不知从何而来a正在编辑代码,突然它出现了,甚至在删除了o自上次成功构建以来编写的代码之后,它仍然向我显示错误。即使我启动了一个我知道有效的备份 这是我所有的代码 PongViewController.m-出现错误之前我正在编辑的代码Objective c 西格伯特不知从哪里冒出来的,objective-c,ios,sigabrt,Objective C,Ios,Sigabrt,我不熟悉用Objective C编程,甚至对编程这类东西也不熟悉。 我正在做一个小而简单的乒乓球游戏,当我试图为电脑播放器制作一个AI时,程序总是“关闭”,显示线程1中的SIGABRT错误 我已经在这里问过这个问题,但没有真正得到答案,只是被要求提供更多的代码 这个错误真的不知从何而来a正在编辑代码,突然它出现了,甚至在删除了o自上次成功构建以来编写的代码之后,它仍然向我显示错误。即使我启动了一个我知道有效的备份 这是我所有的代码 PongViewController.m-出现错误之前我正在编辑
#import "pongViewController.h"
#define kGameStateRunning 1
#define kGameStatePaused 2
#define kMicSpeedX 3
#define kMicSpeedY 4
#define ObtiznostPocitace 15
@implementation pongViewController
@synthesize mic,plosina_a,plosina_b,hrac_score,pocitac_score,gameState,micVelocity,TapToBegin;
- (void)viewDidLoad {
[super viewDidLoad];
self.gameState = kGameStatePaused;
micVelocity = CGPointMake(kMicSpeedX, kMicSpeedY);
[NSTimer scheduledTimerWithTimeInterval:0.05 target:self selector:@selector(gameLoop) userInfo:nil repeats:YES];
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
if(gameState == kGameStatePaused) {
TapToBegin.hidden = YES;
gameState = kGameStateRunning;
} else if (gameState == kGameStateRunning) {
[self touchesMoved:touches withEvent:event];
}
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [[event allTouches] anyObject];
CGPoint location = [touch locationInView:touch.view];
CGPoint xLocation = CGPointMake(location.x,plosina_a.center.y);
plosina_a.center = xLocation;
}
- (void) gameLoop {
if(gameState == kGameStateRunning) {
mic.center = CGPointMake(mic.center.x + micVelocity.x, mic.center.y + micVelocity.y);
if(mic.center.x > self.view.bounds.size.width || mic.center.x < 0) {
micVelocity.x = -micVelocity.x;
}
if(mic.center.y > self.view.bounds.size.height || mic.center.y < 0) {
micVelocity.y = -micVelocity.y;
}
} else {
if (TapToBegin.hidden) {
TapToBegin.hidden = NO;
}
}
//Collision Detection
if (CGRectIntersectsRect(mic.frame,plosina_a.frame)) {
if (mic.center.y < plosina_a.center.y) {
micVelocity.y = -micVelocity.y;
//NSLog(@"%f %f", mic.center,plosina_b.center);
}
}
if (CGRectIntersectsRect(mic.frame,plosina_b.frame)) {
if (mic.center.y > plosina_b.center.y) {
micVelocity.y = -micVelocity.y;
}
}
if(mic.center.y <= self.view.center.y) {
if(mic.center.x < plosina_b.center.x) {
CGPoint compLocation = CGPointMake(plosina_b.center.x - ObtiznostPocitace, plosina_b.center.y);
plosina_b.center = compLocation;
}
if(mic.center.x > plosina_b.center.x) {
CGPoint compLocation = CGPointMake(plosina_b.center.x + ObtiznostPocitace, plosina_b.center.y);
plosina_b.center = compLocation;
}
}
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
//jakovždy nakonec uvolníme co sme si obsadili
- (void)dealloc {
[super dealloc];
[mic release];
[plosina_a release];
[plosina_b release];
[hrac_score release];
[pocitac_score release];
[TapToBegin release];
}
@end
(从调试器控制台)但我认为这不是问题的一部分,但我到底知道什么
This GDB was configured as "x86_64-apple-darwin".Attaching to process 11032.
Couldn't register com.yourcompany.pong with the bootstrap server. Error: unknown error code.
This generally means that another instance of this process was already running or is hung in the debugger.sharedlibrary apply-load-rules all
Current language: auto; currently objective-c
(gdb)
请帮忙,我尝试修复了应用程序中的所有警告,成功了,但仍然一无所获。创建一个新项目,使其成为基于视图的应用程序,并调用项目iTennis。 在您提到的网站上,下载它希望您下载的所有图像文件,并将它们放在项目的resources文件夹中
- 打开iTennisViewController.h并将其放入
- 现在打开iTennisViewController.m文件,按照其发布的确切顺序放入以下代码
argc int 1
argv char ** 0xbffff6f4
*argv char * 0xbffff800
pool NSAutoreleasePool * 0x4b29340
NSObject NSObject {...}
_token void * 0x521a200
_reserved3 void * 0x0
_reserved2 void * 0x0
_reserved void * 0x0
retVal int -1073744132
This GDB was configured as "x86_64-apple-darwin".Attaching to process 11032.
Couldn't register com.yourcompany.pong with the bootstrap server. Error: unknown error code.
This generally means that another instance of this process was already running or is hung in the debugger.sharedlibrary apply-load-rules all
Current language: auto; currently objective-c
(gdb)