iOS - Use fallback paywalls
warning
Fallback paywalls are supported by iOS SDK v2.11 or later.
To maintain a fluid user experience, it is important to set up fallbacks for your paywalls and onboardings. This precaution extends the application's capabilities in case of partial or complete loss of internet connection.
-
If the application cannot access Adapty servers:
It will be able to display a fallback paywall, and access the local onboarding configuration.
-
If the application cannot access the internet:
It will be able to display a fallback paywall. Onboardings include remote content and require an internet connection to function.
important
Before you follow the steps in this guide, download the fallback configuration files from Adapty.
Configuration
- Add the fallback JSON file to your project bundle: open the File menu in XCode and select the Add Files to "YourProjectName" option.
- Call the
.setFallbackmethod before you fetch the target paywall or onboarding.
- Swift
- Swift-Callback
do {
if let urlPath = Bundle.main.url(forResource: fileName, withExtension: "json") {
try await Adapty.setFallback(fileURL: urlPath)
}
} catch {
// handle the error
}
if let url = Bundle.main.url(forResource: "ios_fallback", withExtension: "json") {
Adapty.setFallback(fileURL: url)
}
Parameters:
| Parameter | Description |
|---|---|
| fileURL | Path to the fallback configuration file. |