My app is crashing and getting an EXC_ARITHMETIC error and I don't know why. Here is where the error is happening:
int main(int argc, char *argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, nil); //ERROR IS HERE
[pool release];
return retVal;
}
The error happens when I click a button in the app, it's hooked up in my ViewController.m file like this:
- (IBAction)btnPressed:(UIButton *)sender {
[self btnPressed];
}
Which calls this code from the same file:
- (void)btnPressed {
NSString *strInfo = [[NSString alloc] initWithString:@"Test Info. \r\n"];
NSData *dataInfo = [strInfo dataUsingEncoding:NSUTF8StringEncoding];
[strInfo release];
[socket writeData:dataInfo withTimeout:-1 tag:1];
}
The btnPressed is also called when the app loads and it DOES NOT produce an error. As well if I add a breakpoint to the [self btnPressed];
line then when I click the button in the app it works, stops at the breakpoint and when I click 'continue pr开发者_如何学运维ogram execution' it works without error as well.
Note: I'm using CocoaAsyncSocket to communicate with a Cocoa app.
This seems to be only a problem with iOS 5 sim, running fine in iOS 4.3.
精彩评论