Use fallbacks in iOS SDK
To use fallback paywalls and onboardings:
- In Xcode, use the menu File -> Add Files to "YourProjectName" to add the fallback JSON file you downloaded in the Adapty Dashboard to your project bundle.
- Call the
.setFallback
method. Place this method in your code before fetching a paywall or onboarding, ensuring that the mobile app possesses it when a fallback paywall or onboarding is required to replace the standard one.
Here's an example of retrieving fallback paywall or onboarding data from a locally stored JSON file named ios_fallback.json
.
- 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 file with fallback paywalls and onboardings you downloaded in the Adapty Dashboard. |