     class func JSONResponseSerializer(options: NSJSONReadingOptions = .AllowFragments) -> (NSURLRequest, NSHTTPURLResponse?, NSData?, NSError?) -> (AnyObject?, NSError?) {
         return { (request, response, data, error) in
             var serializationError: NSError?
-            let JSON: AnyObject! = NSJSONSerialization.JSONObjectWithData(data as NSData, options: options, error: &serializationError)
+            let JSON: AnyObject! = NSJSONSerialization.JSONObjectWithData(data, options: options, error: &serializationError)
             return (JSON, serializationError)
         }
     }

                var disposition: NSURLSessionAuthChallengeDisposition = .PerformDefaultHandling
                var credential: NSURLCredential?

                if self.taskDidReceiveChallenge {
                    (disposition, credential) = self.taskDidReceiveChallenge!(session, task, challenge)
                } else {
                    if challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust {

            if let credentials = credentialStorage.credentialsForProtectionSpace(protectionSpace)?.values.array {
                if !credentials.isEmpty {
                    if let credential = credentials[0] as? NSURLCredential {
                        components.append("-u \(credential.user):\(credential.password)")
                    }
                }
            }
