On MoPub for iOS, MPAdView contains a property
/**
* A Boolean value that determines whether the ad view should request ads in test mode.
*
* The default value is NO.
* @warning **Important**: If you set this value to YES, make sure to reset it to NO before
* submitting your application to the App Store.
*/
@property (nonatomic, assign, getter = isTesting) BOOL testing;
Which I have conditionally enabled during testing like so
#ifdef DEBUG
self.adView.testing = YES;
#else
self.adView.testing = NO;
#endif
However, this results in the following error (and test Ads do not show) - note error in truncated for brevity/privacy
NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9843)
2016-07-26 13:20:02.420 [10141:12057531] MOPUB: Banner view (f8cf1caadec0440abfd335457ba174cd) failed. Error: Error Domain=NSURLErrorDomain Code=-1202 "The certificate for this server is invalid. You might be connecting to a server that is pretending to be “testing.ads.mopub.com” which could put your confidential information at risk." UserInfo={NSURLErrorFailingURLPeerTrustErrorKey=<SecTrustRef: 0x7f9af1ec7ee0>, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFStreamErrorDomainKey=3, _kCFStreamErrorCodeKey=-9843, NSErrorPeerCertificateChainKey=<CFArray 0x7f9af1e32af0 [0x1107f8a40]>{type = immutable, count = 2, values = (
0 : <cert(0x7f9af1ed6210) s: *.mopub.com i: DigiCert SHA2 High Assurance Server CA>
1 : <cert(0x7f9af1ee4bc0) s: DigiCert SHA2 High Assurance Server CA i: DigiCert High Assurance EV Root CA>
)}, NSUnderlyingError=0x7f9af30027d0 {Error Domain=kCFErrorDomainCFNetwork Code=-1202 "The certificate for this server is invalid. You might be connecting to a server that is pretending to be “testing.ads.mopub.com” which could put your confidential information at risk." UserInfo={NSErrorFailingURLStringKey=https://testing.ads.mopub.com/m/ad?