How to Load Ad After Certain Time Interval in you App – iOS XCode

If you would like to load an Ad after certain time interval in your App, for eg. 30 seconds after App Launch. You can use the following code to do so –

Put the code inside of your AppDelegate.m applicationDidBecomeActive –

1
[NSTimer scheduledTimerWithTimeInterval:30.0 target:self selector:@selector(fun) userInfo:nil repeats:NO];

Put this code anywhere in the same file and put the Ad code inside it –

1
2
3
-(void)fun {
// Ad Code
}

The NSTimer object above will call the “fun” function after the specified time interval and your Ad will get load up.

Namit Gupta

Technical Lead iOS @ONEChampionship | Ex-SDE2 @ Halodoc, Ex-iOS Lead @ Vokal. ❤️ Swift, designing pixel-perfect UI and writing clean code. Check my portfolio here.

Leave a Reply