Cached response is returned for ad request on Mopub iOS SDK


#1

Hello. I’m working on integrating Mopub into my iOS app and just found that after the Mopub SDK request for an ad, it always return cached response that causes an error
Error: Error Domain=com.mopub.iossdk Code=8 "The operation couldn’t be completed. (com.mopub.iossdk error 8.)"
because there is no data returned in http response headers.

I see that in [MPAdServerCommunicator.adRequestForURL], URLRequest is already configured as [NSURLRequestReloadIgnoringCacheData]. However, in my case, cached data is still returned (maybe from the proxy server).
Is there anything I can do to fix this?


#2

Hello Janken,

This error usually happens when the ad request is not filled. This may be a result of a warmup issue where an inactive ad unit does not have its information cached on our servers or there may be situations where ad sources are being filtered, resulting in no ads for the ad unit.

Please email support@mopub.com with your username, a link to this issue, and the ad unit you are using.

Thanks,
Edward


#3

Hello Edward,

Thank you for your response.
It’s ok now. It seems that [NSURLRequestReloadIgnoringCacheData] only ignores cache on local system but not on remote server. I have added HTTP header “Cache-Control: no-cache” to the ad request and the problem is gone.
However, It would be great if you can pass this issue to the development team and include the fix in the next version of SDK.