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).