title: dyld: Symbol not found: _OBJC_CLASS_$_NSHTTPURLResponse
body: <p>I wrote a Swift App with Xcode6 Beta 2 that does some networking using CFNetwork classes such as <code>NSURLRequest</code> and <code>NSHTTPURLResponse</code>.</p>
  
  <p>The App works just fine with iOS 8, still, when I try to run it on an iOS 7 device or in the simulator running iOS 7, I get the following error when starting the App:</p>
  
  <pre><code>dyld: Symbol not found: _OBJC_CLASS_$_NSHTTPURLResponse
    Referenced from: /Users/patrick/Library/Developer/CoreSimulator/Devices/B0A61F43-A67C-4803-8F5D-77C3972107BE/data/Applications/E0C7C89F-9EEE-4893-BE5B-FCC224F2855D/CheckYourWeather.app/CheckYourWeather
    Expected in: /Applications/Xcode6-Beta2.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk/System/Library/Frameworks/CFNetwork.framework/CFNetwork
   in /Users/patrick/Library/Developer/CoreSimulator/Devices/B0A61F43-A67C-4803-8F5D-77C3972107BE/data/Applications/E0C7C89F-9EEE-4893-BE5B-FCC224F2855D/CheckYourWeather.app/CheckYourWeather
  </code></pre>
  
  <p>I've done some research and found out that it's a linking problem. Still, I know that the classes I'm using are already available in iOS 7.</p>
  
  <p>I also tried to add the <code>CFNetwork.framework</code> to the frameworks in the project settings and set it to optional, which only caused the App to crash during runtime.</p>
  
  <p>The confusing part for me is: I wrote a Test App and just pasted my code I used in the main app into it and it worked just fine. Therefore the code is probably not the problem.</p>
  
  <p>Deleting the App from the Simulator/Device, make a clean on the project and deleting Xcode's DerivedData haven't solved the problem.</p>
  
  <p><strong>Update:</strong></p>
  
  <p>Here's the code that causes the crash:</p>
  
  <pre><code>extension NSURLRequest {
      class func plainPostRequest(url: NSURL, httpBody: String) -&gt; NSURLRequest {
          let urlRequest = NSMutableURLRequest(URL: url)
          urlRequest.HTTPMethod = "POST"
          urlRequest.HTTPBody = httpBody.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)
          urlRequest.setValue("text/plain", forHTTPHeaderField: "Content-Type")
  
          return urlRequest
      }
  }
  </code></pre>
  
  <p>But that's just an example. Any use of CFNetwork classes causes the App to crash during start.</p>