I have implemented a method on my view controller (via a protocol) which my game engine calls to present Interstitial advertisements.
I want to prevent the control loop from returning to the caller while a full screen advertisement is in play, and not affect subsequent animations of SKScene objects happening while the ad cleans up and delays processing.
I have achieved this with the following code, which checks if an advert will be presented, and blocks the current thread until the advert is no longer being shown, and the view isn't unloading for that ad. (Without the dismiss check, my transitions appeared to be effected too early).
I know that the iAD model is simpler in iOS7, no need to implement delegates etc. But what is the right way of waiting for interstitial ads to complete in iOS7. (Note, I'm using SpriteKit, not storyboarding). Do I have to revert to using iOS6 or less style delegates?
-(void)presentFullScreenAd
{
if( [self requestInterstitialAdPresentation] )
{
while( self.isPresentingFullScreenAd || self.isBeingDismissed )
{
// wait till we have finished before continuing
[NSRunLoop.currentRunLoop runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.5]];
}
}
}