The request timed out


I’m trying to integrate mopub in one of my apps and I started seeing one really weird issue. Then I decided to download the sample mopub app ( ) to see if the same issue was also happening.

It turned out that the issue is happening even on the sample mopub app.

While I’m connected to the wifi, the ads are loaded just fine, but as soon as I switch to 4G/3G, I start getting “The request timed out”.

After further investigation, I could isolate this issue to one specific Brazilian carrier: VIVO which is the major cellular carrier in Brazil.

Is there anybody seeing the same issue? Any ideas how to workaround this?

BTW: the mopub support stopped responding to my emails about this issue.

Some Logs:

Nov 5 18:06:08 Paulo-Venturi MoPubSampleApp[1819] : MOPUB: Banner view (bca65d9e7fe64b50b8cc82b2ec47fb62) loading ad with MoPub server URL:
Nov 5 18:06:18 Paulo-Venturi MoPubSampleApp[1819] : MOPUB: Banner view (bca65d9e7fe64b50b8cc82b2ec47fb62) failed. Error: Error Domain=NSURLErrorDomain Code=-1001 “The request timed out.” UserInfo=0x1700ee680 {NSUnderlyingError=0x17424c2d0 “The request timed out.”, NSErrorFailingURLStringKey=, NSErrorFailingURLKey=, NSLocalizedDescription=The request timed out.}


Sorry to hear you are having issues in Brazil. The folks from the MoPub team may have some more specifics via

Having said that you could perform some network checks on adLoad. Here is a sample ViewController:

  import UIKit
  import MoPub

  class ViewController: UIViewController
  , MPAdViewDelegate

      // TODO: Replace this test id with your personal ad unit id
      var adView: MPAdView = MPAdView(adUnitId: "AD_UNIT_ID", size: MOPUB_BANNER_SIZE)

      override func viewDidLoad() {
          self.adView.delegate = self
          self.adView.frame = CGRectMake(0, self.view.bounds.size.height - MOPUB_BANNER_SIZE.height,
              MOPUB_BANNER_SIZE.width, MOPUB_BANNER_SIZE.height)

      func loadAdIfReachable(){
          if Network.isConnected() {
              // Network is connected ...
          } else {
              // No network -- do something truly amazing...

      func adViewDidFailToLoadAd(view: MPAdView!) {
          // ISSUE
          // There is still an issue loading the ads e.g. Timeout Error....

      func viewControllerForPresentingModalView() -> UIViewController {
          return self


Putting this together very quickly you could perform some Network specifics e.g.

  import Foundation
  import CoreTelephony
  import SystemConfiguration

  public class Network {

      class func carrier() -> String{
          var carrier = CTCarrier().carrierName
          if carrier == nil {
              carrier = "No Carrier"
          return carrier

      class func isReachable() -> Bool {
          let reachabilityFlags:SCNetworkReachabilityFlags = SCNetworkReachabilityFlags(kSCNetworkReachabilityFlagsReachable)
          if 0 != reachabilityFlags & SCNetworkReachabilityFlags(kSCNetworkReachabilityFlagsReachable) {
              return true
          return false

      class func isConnected() -> Bool {
          var zeroAddress = sockaddr_in(sin_len: 0, sin_family: 0, sin_port: 0, sin_addr: in_addr(s_addr: 0), sin_zero: (0, 0, 0, 0, 0, 0, 0, 0))
          zeroAddress.sin_len = UInt8(sizeofValue(zeroAddress))
          zeroAddress.sin_family = sa_family_t(AF_INET)

          let defaultRouteReachability = withUnsafePointer(&zeroAddress) {
              SCNetworkReachabilityCreateWithAddress(nil, UnsafePointer($0)).takeRetainedValue()

          var flags: SCNetworkReachabilityFlags = 0
          if SCNetworkReachabilityGetFlags(defaultRouteReachability, &flags) == 0 {
              return false

          let isReachable = (flags & UInt32(kSCNetworkFlagsReachable)) != 0
          let needsConnection = (flags & UInt32(kSCNetworkFlagsConnectionRequired)) != 0

          return (isReachable && !needsConnection) ? true : false

Hope this makees some sense. It would be great to see the output from Network specifically isConnected() and isReachable() when the ad fails to load.


Hello Everyone,

There was previously an issue with users using the ISPs Embratel, Vivo, and Net Servicos de Comunicacao not being able to connect to the domain. This issue is now resolved. If there are any further issues or if this arises again, please contact to report the issue.