J. Doe J. Doe - 1 year ago 114
Swift Question

What is the best way to create a custom popup interstitial ad?

I currently have an app written in objc and swift.

I would like to implement a custom popup interstitial ad that runs for a few seconds and then presents an X to close the popup and continues doing so every couple minutes unless the
Remove Ad's in-ap purchase has been purchased.

I already have the in-app purchases setup. I would really appreciate the help or a demo/sample would be fantastic!

Answer Source

Create a separate controller with an image view which will popup according to the timer set in app delegate. close X should also have a timer

 func applicationDidEnterBackground(application: UIApplication) {

    if (!isShowingAd && adTimer != nil) {
        adTimerTimeLeft = adTimer!.fireDate.timeIntervalSinceNow

    if adUpdateTimer != nil
        adUpdateTimerTimeLeft = 60 * 60 //one hour

//setting timer var adTimer: NSTimer? timer = NSTimer.scheduledTimerWithTimeInterval(10.0, target: self, selector: #selector(AppDelegate.updateAd), userInfo: nil, repeats: true) timer?.fire()

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download