2

The below code snippet using Alamofire works fine in iOS app but the code does not work in iOS UI Testing target.

let configuration = NSURLSessionConfiguration.defaultSessionConfiguration()
configuration.HTTPAdditionalHeaders =   Alamofire.Manager.defaultHTTPHeaders
manager = Alamofire.Manager(configuration: configuration)
manager!.request(.GET, "https://www.google.com")
        .responseString { response in
            print(response.request)  // original URL request
            print(response.response) // URL response
            print(response.result)   // result of response serialization
            print("HTML: \(response.result.value)")
    }

The completion handler never gets invoked in UI Testing target.

If I add .progress block to request, that is getting executed, but the completionHandler still does not get executed.

Can someone please shed light on what I might be doing wrong.

nhgrif
  • 61,578
  • 25
  • 134
  • 173

0 Answers0