Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 西格伯特不知从哪里冒出来的_Objective C_Ios_Sigabrt - Fatal编程技术网

Objective c 西格伯特不知从哪里冒出来的

Objective c 西格伯特不知从哪里冒出来的,objective-c,ios,sigabrt,Objective C,Ios,Sigabrt,我不熟悉用Objective C编程,甚至对编程这类东西也不熟悉。 我正在做一个小而简单的乒乓球游戏,当我试图为电脑播放器制作一个AI时,程序总是“关闭”,显示线程1中的SIGABRT错误 我已经在这里问过这个问题,但没有真正得到答案,只是被要求提供更多的代码 这个错误真的不知从何而来a正在编辑代码,突然它出现了,甚至在删除了o自上次成功构建以来编写的代码之后,它仍然向我显示错误。即使我启动了一个我知道有效的备份 这是我所有的代码 PongViewController.m-出现错误之前我正在编辑

我不熟悉用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.xib并将图片链接到头文件中声明的IBOutlets。另外,如果你不知道如何做到这一点,我认为网站上有一个关于如何做到这一点的视频链接。如果看不到链接,请转到youtube并在xcode上观看Newboston的视频。他教你这些东西的基本知识,你无论如何都应该看他的视频

  • 现在打开iTennisViewController.m文件,按照其发布的确切顺序放入以下代码


是的,这是我的问题,但没有人回答,我不知道它是如何工作的,但我有一种感觉,一段时间后,帖子丢失了,没有人会回答,我有点绝望,因为我不知道该怎么做。我正在一步一步地做这个应用程序,在icodeblog.com上有一个教程。你能给我这个游戏的确切链接吗?如果我能看到您从哪里获得数据,我可以提供更多帮助。好的,我将编辑您的代码应该是什么样子的答案,所以请复制它。确保你的资源文件夹中有所有内容的图像,并注意文件名区分大小写是的,非常感谢,我已经让应用程序工作了,我正在尝试制作三种不同的人工智能,使其达到3个难度级别-因为我不知道我大部分时间都在做什么,我只是胡说。但是有时候狗屎也会发生。是的,如果我发布的东西不起作用,去这个网站看那些视频。制作它们的人是开始编程的最好导师,所以我强烈建议你看他的东西。
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)