title: iOS - App crash without error during loop process
body: <p>during a loop process, my App crash without error. The array count is equal to 175260. With profiler I don't have leaks, so I don't know why the App exit, maybe the CPU usage 100% during a lot of time? </p>
  
  <p>Thank you for your help.</p>
  
  <p>Just this code following crash the App :</p>
  
  <pre><code>    for(unsigned int i = 0; i &lt;14;i++)
      {
          if(findSensor[i]==YES)
          {
              for(unsigned int j = 1; j &lt;[array count];j++)
              {
                  @autoreleasepool {
  
                      if([[[[array objectAtIndex:j] componentsSeparatedByString:@";"] objectAtIndex:0] isEqualToString:[NSString stringWithFormat:@"%d",10*(i+1)]])
                      {
                          //Code here 
                      }
                  }
              }
          }
      }
  </code></pre>
  
  <p>The full code is :</p>
  
  <pre><code>NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
  NSString *documentsDirectory = [paths objectAtIndex:0];
  NSString *fileName = [NSString stringWithFormat:@"%@/%@",documentsDirectory,[ibNavSettings interfaceSettings].selectedFileToDataBase];
  
  NSFileHandle *fh = [NSFileHandle fileHandleForReadingAtPath:fileName];
  
  NSFileHandle *output = [NSFileHandle fileHandleForReadingAtPath:[NSString stringWithFormat:@"%@/%@10",documentsDirectory,[ibNavSettings interfaceSettings].selectedFileToDataBase]];
  
  if(output == nil)
  {
  
      NSManagedObjectContext *context = [self managedObjectContext];
      _recordlocal = [NSEntityDescription insertNewObjectForEntityForName:@"RECORD" inManagedObjectContext:context];
      _recordlocal.date = [ibNavSettings interfaceSettings].selectedFileToDataBase;
  
      NSData *inputData = [NSData dataWithData:[fh readDataToEndOfFile]];
  
      NSString *inputString = [[NSString alloc] initWithData:inputData encoding:NSUTF8StringEncoding];
  
      NSArray *array = [[NSArray alloc] initWithArray:[inputString componentsSeparatedByString:@"\n"]];
  
  
      for(unsigned int i = 0; i &lt;14;i++)
      {
          if(findSensor[i]==YES)
          {
              [[NSFileManager defaultManager] createFileAtPath:[NSString stringWithFormat:@"%@/%@%d",documentsDirectory,[ibNavSettings interfaceSettings].selectedFileToDataBase,10*(i+1)] contents:nil attributes:nil];
  
              NSMutableString *saveString = [[NSMutableString alloc] init];
  
              int count = 0;
  
              for(unsigned int j = 1; j &lt;[array count];j++)
              {
                  @autoreleasepool {
  
                      if([[[[array objectAtIndex:j] componentsSeparatedByString:@";"] objectAtIndex:0] isEqualToString:[NSString stringWithFormat:@"%d",10*(i+1)]])
                      {
                          [saveString appendString:[array objectAtIndex:j]];
                          [saveString appendString:@"\n"];
                          if(i == 0)
                              count++;
                          progress++;
                          pourcent = progress/total;
                          load = pourcent*100;
                          if(load%5==0)
                              [self performSelectorInBackground:@selector(changeUI:)withObject:[NSNumber numberWithFloat:(pourcent)]];
  
  
                      }
                  }
              }
  
              [saveString writeToFile:[NSString stringWithFormat:@"%@/%@%d",documentsDirectory,[ibNavSettings interfaceSettings].selectedFileToDataBase,10*(i+1)] atomically:YES encoding:NSUTF8StringEncoding error:nil];
              if(i == 0)
                  _recordlocal.count = [[NSNumber alloc] initWithInt:(count/50)];
          }
  
      }
  
      _recordlocal.load = [[NSNumber alloc] initWithBool:YES];
  
      NSError *error = nil;
      if (![context save:&amp;error]) {
          NSLog(@"Core data error %@, %@", error, [error userInfo]);
          abort();
      }
  </code></pre>