1

I am trying to create a dangling pointer by using the following code:

-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    NSLog(@"I am touched!");

    // bar is an instance variable defined by  NSString *bar;  in the interface
    if (!bar) {
        NSLog(@"bar is being init");
        bar = [NSString stringWithFormat:@"Hello I am %i", arc4random() % 1000];
        NSLog(@"bar is now %@", bar);
    } else {
        NSLog(@"bar is %@", bar);
    }
}

So I can successfully crash the program on the second touch on an iPad 2 device (not Simulator), but then when I tried adding a [bar retain]; after the bar = assignment line to see that there will be no dangling pointer, the app cannot start and just keep on showing:

Couldn't register com.mycompany.TryIOSAppLeak 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.(lldb)

Is there a way to make it start again? (besides rebooting the iPad and the iMac or restarting Xcode).

Sarah W
  • 889
  • 1
  • 6
  • 10
  • This "bootstrap server" error happens occasionally to almost everyone. It has nothing to do with that particular code. – Kurt Revis May 14 '12 at 06:16
  • so do you just have to reboot your iPad? Or somehow kill that instance of process? – Sarah W May 14 '12 at 06:19
  • Yup........the app is probably hung on the device. Happens quite often if the app crashes on the device. – Gwynant Jones May 14 '12 at 06:21
  • 1
    There are a few ways to fix it. You could search for previous answers. For instance: [one](http://stackoverflow.com/questions/788277/iphone-strange-error-when-testing-on-simulator), [two](http://stackoverflow.com/questions/3375442/bootstrap-server), [three](http://stackoverflow.com/questions/5727388/couldnt-register-com-xxxxx-deviceapp-with-the-bootstrap-server), [four](http://stackoverflow.com/questions/3905718/bootstrap-server-error-in-xcode-iphone). – Kurt Revis May 14 '12 at 06:22

1 Answers1

2

Ahh, this happens to me a lot. Try to force kill the app once it has a crash before you restart, the app is hung on the device. But once it happens delete the app on the device/simulator, restart the device/simulator and restart XCode. Very annoying right! Alternatively you could edit your scheme and change debugger to GDB. It has nothing to do with your code.

MCKapur
  • 9,127
  • 9
  • 58
  • 101