title: iOS Crash Log NSObject doesNotRecognizeSelector: - at which line?
body: <p>I have recorded a crash of my app, but the last line in my app (5 Control) points just to the method begin. How do I know in which line the problem is?</p>
  
  <pre><code>0   CoreFoundation                  0x185f0af50 __exceptionPreprocess + 132
  1   libobjc.A.dylib                 0x1924141fc objc_exception_throw + 60
  2   CoreFoundation                  0x185f0fc04 -[NSObject(NSObject) doesNotRecognizeSelector:] + 220
  3   CoreFoundation                  0x185f0d930 ___forwarding___ + 912
  4   CoreFoundation                  0x185e2d5dc _CF_forwarding_prep_0 + 92
  5   Control                         0x10005acb4 -[PaymillPaymentService handleTransactionListRequest:] (PaymillPaymentService.m:211)
  6   Foundation                      0x186a7416c __103+[__NSOperationInternal _observeValueForKeyPath:ofObject:changeKind:oldValue:newValue:indexes:context:]_block_invoke96 + 28
  7   libdispatch.dylib               0x1929ec014 _dispatch_call_block_and_release + 24
  8   libdispatch.dylib               0x1929ebfd4 _dispatch_client_callout + 16
  9   libdispatch.dylib               0x1929f32b8 _dispatch_root_queue_drain + 556
  10  libdispatch.dylib               0x1929f34fc _dispatch_worker_thread2 + 76
  11  libsystem_pthread.dylib         0x192b816bc _pthread_wqthread + 356
  12  libsystem_pthread.dylib         0x192b8154c start_wqthread + 4
  </code></pre>
  
  <p>Here the [lengthy] method code. I see a couple of places where I can add the check but how to I know it for sure that I fixed the issue? The problem is sporadical and I cannot reproduce it easily.</p>
  
  <pre><code>- (void)handleTransactionListRequest:(ServiceRequest *)serviceRequest
  {
      LRURLRequestOperation* operation = serviceRequest.operation;
      NSHTTPURLResponse *response = (NSHTTPURLResponse *)operation.URLResponse;
  
      if (response.statusCode == 200)
      {
          if (operation.responseData)
          {
              NSError *parserError = nil;
              NSDictionary *data = [NSJSONSerialization JSONObjectWithData:operation.responseData options:0 error:&amp;parserError];
  
  
              //NSLog(@"%@", data);
              if (!parserError)
              {
                  NSArray* transactions = [data objectForKey:@"data"];
  
                  if (0 == serviceRequest.currentOffset)
                  {
                      NSNumber* totalCountObj =  [data objectForKey:@"data_count"];
                      serviceRequest.totalCount = [totalCountObj intValue];
                  }
  
                  int loadedCount = 0;
                  if (transactions)
                  {
                      for (id object in transactions)
                      {
                          TransactionInfo* info  = [self createTransactionFrom:object];
                          [serviceRequest.transactionList addTransaction:info];
                          [info release];
                          loadedCount++;
                      }
  
                  }
  
                  if (loadedCount + serviceRequest.currentOffset &gt;= serviceRequest.totalCount)
                  {
                      if ([serviceRequest.delegate respondsToSelector:@selector(transactionListLoadingComplete:)])
                          [serviceRequest.delegate transactionListLoadingComplete:serviceRequest];
  
                      serviceRequest.transactionList.timeStamp = [[NSDate date] timeIntervalSince1970];
                      NSLog(@"COMPLETE: %d transaction loaded ", serviceRequest.totalCount);
                  }
                  else
                  {
                      serviceRequest.currentOffset += loadedCount;
  
                      bool needToContinue = YES;
  
                      if ([serviceRequest.delegate respondsToSelector:@selector(transactionListLoadingContinue:)])
                          needToContinue = [serviceRequest.delegate transactionListLoadingContinue];
  
                      if (needToContinue)
                      {
                          [self continueRetrievingTransactionListFor:serviceRequest];
                          NSLog(@"CONTINUE: %d of %d loaded ", serviceRequest.currentOffset, serviceRequest.totalCount);
                      }
  
                  }
  
                  return; // all OK cases
              }
          }
  
      }
  
      if ([serviceRequest.delegate respondsToSelector:@selector(transactionListLoadingFailed:with:)])
          [serviceRequest.delegate transactionListLoadingFailed:serviceRequest with:response.statusCode];
      NSLog(@"ERROR: Loading Transactions Response Code: %ld", (long)response.statusCode);
  
  }
  </code></pre>