Last active
June 20, 2017 16:47
-
-
Save iannase/91f9163e1d79e1acf26b586bd6006bf1 to your computer and use it in GitHub Desktop.
iOS - Launch review if it's the first time opening and ad if it's not
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let when = DispatchTime.now() + 1 // change 1 to desired number of seconds | |
let launchedBefore = UserDefaults.standard.bool(forKey: "launchedBefore") | |
DispatchQueue.main.asyncAfter(deadline: when) { | |
if #available(iOS 10.3, *){ | |
if !launchedBefore { | |
SKStoreReviewController.requestReview() | |
UserDefaults.standard.set(true, forKey: "launchedBefore") | |
} else { | |
self.interstitialAd = self.createAndLoadInterstitial() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment