login about faq


Hey Lockergnome,

Right now I've got a really confusing bug in my iOS game. When the user has made a move this selector is called. The weird thing about it is that I perform this at every move but only once the map is completely finished it crashes.

With NSLog I've already seen that it does reach the end of the method called but the point where it want's to return to the previous method is the point where it crashes.

The main method which calls the selector on the main thread -(void)hasGotScore:(int)score newWords:(NSMutableArray*)newWords { NSLog(@"score! %i",score); scr = score;

if(gameOver)
    [[GCHelper sharedInstance] reportScore:scr];

    //if not performend on the main thread the text will all go black
    [self performSelectorOnMainThread:@selector(processScore:) withObject:[NSArray arrayWithObjects:[NSNumber numberWithInt:score],newWords, nil] waitUntilDone:YES];
    NSLog(@"yup, it's done here");
}

And the end of the processScore

-(void)processScore:(NSArray *)objs
{
    //real code here finishes without any problems...
    NSLog(@"Done here!");
}

The output log

2012-03-06 13:34:41.211 Multiword[230:707] Done here!
(There should be a "yup, it's done here" like in every other call but there isn't)
(gdb)

(Also this appears in the console log obtained through XCode's Organizer (CMD+Shift+2) -> console)
Mar  6 13:43:39 unknown SpringBoard[15] <Warning>: Application 'ms_test' exited abnormally with signal 11: Segmentation fault: 11

I have already figured out that the code is trying to access a nil object but there is none that it needs to access.

Do any of you know what is going on? Oh and I am also asking this same question on other forums, if a solution is found I'll edit it in.

Edit:

I have found the solution, not really one that I understand but it works. I had just 4 lines of code that actually needed to be run on the main thread and by moving those into a seperate method and calling that method on the main thread while keeping the rest in the current thread did the fix. I still don't know what was going on but at least it got fixed.

asked Mar 06 '12 at 07:43

nitrocrime's gravatar image

nitrocrime
3.6k6277125

closed Mar 07 '12 at 20:41

DJ%20Scooby%20Doo's gravatar image

DJ Scooby Doo
9.5k232279379

The question has been closed for the following reason "Question was answered." by DJ Scooby Doo Mar 07 '12 at 20:41

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported


Join Us in the Chat Room

Tags:

×271
×197
×63
×43
×13
×4

Asked: Mar 06 '12 at 07:43

Seen: 816 times

Last updated: Mar 07 '12 at 20:41