- (void)viewDidLoad {
[super viewDidLoad];
dispatch_queue_t queue = dispatch_queue_create("myQueue", DISPATCH_QUEUE_CONCURRENT);
for (int i = 0; i < 10000; i++) {
dispatch_async(queue, ^{
self.str = [NSString stringWithFormat:@"asgdhjagsjhd"];
});
}
}Pourquoi ce crash simultané code c objectif
chaque fois que je lance ce code, il va planter, quelqu'un peut me dire pourquoi?
Vous devriez garder votre file d'attente en dehors de 'viewDidLoad'. – clemens