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 program execution' it works without error as well.
Note: I'm using CocoaAsyncSocket to communicate with a Cocoa app.
这似乎只是iOS 5 sim的问题,在iOS 4.3中可以正常运行。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.