Closed Arti3DPlayer closed 6 years ago
Please place a debugger call and step through to determine at which point the plugin has determined your app is not ready for displaying a rating prompt.
Any update on this? I am having the same issue with swift3 branch
If you step through the logic, you will be able to see at which point the plugin determined the rating criteria have not been met.
I had the same issue and found why is it:
Reason is because even you're not using some of the flags, they're set and have default values already, which means you have to set it as your convenience in order to make it work properly. I set my own values for these flags and got it working.
Look, this function is the one in the library which decides whether rate conditions have been met or not, so you can see for instance that if daysUntilPrompt
(default value of 30 btw) is not met yet bcz you just started testing your app today, it will return and you won't see the prompt, and so on with the remaining flags.
Hope it helps!
fileprivate func ratingConditionsHaveBeenMet() -> Bool {
if debugEnabled {
return true
}
if appID.isEmpty {
return false
}
// check if the app has been used long enough
let timeIntervalOfFirstLaunch = userDefaultsObject?.doubleForKey(keyForArmchairKeyType(ArmchairKey.FirstUseDate))
if let timeInterval = timeIntervalOfFirstLaunch {
let dateOfFirstLaunch = Date(timeIntervalSince1970: timeInterval)
let timeSinceFirstLaunch = Date().timeIntervalSince(dateOfFirstLaunch)
let timeUntilRate: TimeInterval = 60 * 60 * 24 * Double(daysUntilPrompt)
if timeSinceFirstLaunch < timeUntilRate {
return false
}
} else {
return false
}
// check if the app has been used enough times
let useCount = userDefaultsObject?.integerForKey(keyForArmchairKeyType(ArmchairKey.UseCount))
if let count = useCount {
if UInt(count) <= usesUntilPrompt {
return false
}
} else {
return false
}
// check if the user has done enough significant events
let significantEventCount = userDefaultsObject?.integerForKey(keyForArmchairKeyType(ArmchairKey.SignificantEventCount))
if let count = significantEventCount {
if UInt(count) < significantEventsUntilPrompt {
return false
}
} else {
return false
}
// Check if the user previously has declined to rate this version of the app
if userHasDeclinedToRate() {
return false
}
// Check if the user has already rated the app?
if userHasRatedCurrentVersion() {
return false
}
// If the user wanted to be reminded later, has enough time passed?
let timeIntervalOfReminder = userDefaultsObject?.doubleForKey(keyForArmchairKeyType(ArmchairKey.ReminderRequestDate))
if let timeInterval = timeIntervalOfReminder {
let reminderRequestDate = Date(timeIntervalSince1970: timeInterval)
let timeSinceReminderRequest = Date().timeIntervalSince(reminderRequestDate)
let timeUntilReminder: TimeInterval = 60 * 60 * 24 * Double(daysBeforeReminding)
if timeSinceReminderRequest < timeUntilReminder {
return false
}
} else {
return false
}
// if we have a global set to not show if the end-user has already rated once, and the developer has not opted out of displaying on minor updates
let ratedAnyVersion = userDefaultsObject?.boolForKey(keyForArmchairKeyType(ArmchairKey.RatedAnyVersion))
if let ratedAlready = ratedAnyVersion {
if (!shouldPromptIfRated && ratedAlready) {
return false
}
}
return true
}
In
AppDelegate.swift
i added:Then in my
ViewController
:But pop up window never shown. What is wrong ? I'm using
swift 3
version