It is a very simple example. I cannot explain why these lines of code cause a crash. I only want to create multiple threads in a for loop. In the AppDelegate:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
for (int i = 0; i < 5; i++) {
[self performSelectorInBackground:@selector(workInBackground)
withObject:nil];
}
return YES;
}
-(void)workInBackground{
}
The app crashes only sometimes (lldb crash, iPhone Simulator 5.0 - 6.1, Xcode Version 4.6.2). I use ARC.
Can anyone explain this behavior?
Update
I "solved" the problem. When I perform a cleanup before each test, the crash no longer occurs.