title: Command failed due to signal: Segmentation fault: 11 in Xcode 8.1, Swift 3
body: <p>I know this question was asked before, but other questions relate to the older Xcode versions and answers suggest that this bug was resolved. </p>
  
  <p>I get this error on the newest <code>Xcode 8.1 (8B62)</code> which is the most recent one (and <code>Swift3</code>) and still can not find a solution for my case.</p>
  
  <p><strong>Happens when:</strong></p>
  
  <ul>
  <li><code>Swift 3</code> and <code>Objective-C</code> are bridged together. </li>
  <li><code>Swift</code> code calls <code>Objective-C</code> method which may throw an error (not in all but in specific cases only, more details in included code snippets below).</li>
  </ul>
  
  <p>I was struggling with this for almost whole day and dissected the essence into the minimum demonstration project capable of reproducing this mysterious error. 
  It is available for everyone on <code>GitHub</code>, so feel free to try and help with this:</p>
  
  <p><strong>UPDATE - Includes solution and explanation to the issue:</strong> (thanks to <em>@CodaFi</em>)
  <a href="https://github.com/lukaszmargielewski/SegmentationFault11" rel="nofollow noreferrer">https://github.com/lukaszmargielewski/SegmentationFault11</a></p>
  
  <p>Here is the code causing it:</p>
  
  <p><strong>Swift 3 code:</strong></p>
  
  <pre><code>   class SegmentationFault11 {
  
          let responseProcessor = NetworkResponseProcessor() // Objective-C class
          let url = URL(string: "https://example.com")!
  
          func epicFail() {
              URLSession.shared.dataTask(with: url) { (data, response, error) in
                  do {
                      _ = try self.responseProcessor.process(response, data: data, networkError: error)
                  } catch {}
              }.resume()
          }
      }
  </code></pre>
  
  <p><strong>Objective-C code:</strong></p>
  
  <pre><code>// NetworkResponseProcessor.h
  
  @interface NetworkResponseProcessor : NSObject
  
  - (nullable id)process:(nullable NSURLResponse *)response
                    data:(nullable NSData *)data
            networkError:(nullable NSError *)networkError
                   error:(NSError * _Nonnull * _Nullable)error;
  
  @end
  </code></pre>