dimanche 7 février 2016

Displaying Interstitial Advert A 'Fraction Of The Time' - i.e. NOT Every Time

A simple question.

I would like an interstitial advert to show a fraction of the time when a user presses a button (executes an IBAction).

I have used the following code:

@IBAction func someButtonAction(sender: AnyObject) { 
...
 //Interstitial Ad:

    let rand = Int(arc4random_uniform(3))
    let adNo = 2

    if(adNo == rand)
    {
        loadInterstitialAd()
    }

.... }

This should make the interstitial advert show 25% of the time.

Can anyone please let me know if this is correct code? It works in my simulator, I just want to make sure my code is efficient and I'm not breaching any Apple advertising conventions by doing this.

Thanks!




Aucun commentaire:

Enregistrer un commentaire