watchOS/visionOS
Install Qonversion SDK to implement in-app subscriptions, validate user receipts, get subscription analytics, and send subscription events to third-party integrations.
Install SDK
Qonversion supports Cocoapods and Swift Package Manager to package your dependencies as a framework.
Install via Cocoapods
Add dependency to Podfile
.
pod 'Qonversion'
Run pod install
in the project directory to download the dependency.
pod install
Install via Apple Swift Package Manager
Open Xcode, go to File β App packages... and enter the package URL https://github.com/qonversion/qonversion-ios-sdk
to the search bar to import the package.
Data sharing between iOS and watchOS
Please note that for our SDK to work correctly in the watchOS application (as well as when working with iOS Extensions), it is necessary to set up data sharing between iOS and watchOS applications so that we can identify the same user across both applications.
First, you need to enable data sharing between your app and shared extensions.
- Enable app groups for the containing app and extension via Xcode or the Developer portal. Choose your App target in Xcode. Select
Signing & Capabilities
, click+ Capability
and selectApp Groups
. - Register the app group in the portal. In Xcode, add the new App Group ID.
- Choose that App Group ID for the extension and containing app.
- Pass user defaults instance created with a suite name to Qonversion via Qonversion.Configuration
setCustomUserDefaults()
function.
let config = Qonversion.Configuration(projectKey: "project_key", launchMode: .subscriptionManagement)
...
// any other configurations
...
config.setCustomUserDefaults(.init(suiteName: "app_groups_id_from_previous_step"))
Qonversion.initWithConfig(config)
QONConfiguration *configuration = [[QONConfiguration alloc] initWithProjectKey:@"project_key" launchMode:QONLaunchModeSubscriptionManagement];
...
// any other configurations
...
[configuration setCustomUserDefaults:[[NSUserDefaults alloc] initWithSuiteName:@"app_groups_id_from_previous_step"]];
[Qonversion initWithConfig:configuration];
After those steps, all content stored in the user defaults will be shared between the watchOS App and containing App.
Updated 3 days ago