Skip to main content

iOS

What is RevenueCat?โ€‹

RevenueCat provides a backend and a wrapper around StoreKit and Google Play Billing to make implementing in-app purchases and subscriptions easy. With our SDK, you can build and manage your app business on any platform without having to maintain IAP infrastructure. You can read more about how RevenueCat fits into your app or you can sign up free to start building.

Requirementsโ€‹

Xcode 14.0.0+

Supported Platformsโ€‹

PlatformMinimum target
iOS11.0+
tvOS11.0+
macOS10.13+
watchOS6.2+
visionOS1.0+

Installationโ€‹

RevenueCat for iOS can be installed either via CocoaPods, Carthage, or Swift Package Manager.

๐Ÿ“˜

Already have 3.x installed? View our migration guide to 4.x โžก๏ธ

Install via Swift Package Managerโ€‹

You can use Swift Package Manager to add RevenueCat to your Xcode project. Select File ยป Add Packages... and enter the repository URL https://github.com/RevenueCat/purchases-ios.git into the search bar (top right). Set the Dependency Rule to Up to next major, and the version number to 4.0.0 < 5.0.0. Check RevenueCat when a prompt for "Choose Package Products for purchases-ios" appears. Finally, choose the target where you want to use it.

The library should have been added to the Swift Package Dependencies section and you should be able to import it now.

Install via Swift Package Manager with Xcode 15โ€‹

Select File ยป Add Packages Dependencies... and enter the repository URL https://github.com/RevenueCat/purchases-ios.git into the search bar (top right). Set the Dependency Rule to Up to next major, and the version number to 4.0.0 < 5.0.0. When "Choose Package Products for purchases-ios" appears, Xcode adds all libraries to your target by default. Select "None" for RevenueCat_CustomEntitlementComputation and ReceiptParser.

Install via CocoaPodsโ€‹

To always use the latest release, add the following to your Podfile:

pod 'RevenueCat'

Alternatively, pin to a specific minor version:

pod 'RevenueCat', '~> 4.15'

And then run:

pod install

This will add RevenueCat.framework to your workspace.

Install via Carthageโ€‹

To always use the latest release, add the following to your Cartfile:

github "revenuecat/purchases-ios"

Alternatively, pin to a specific minor version:

github "revenuecat/purchases-ios" ~> 4.15.0

Carthage with XCFrameworksโ€‹

If you're using Carthage version >= 0.37, you can use RevenueCat as an XCFramework instead of a Universal Framework. This makes setup easier, since you don't have to set up build phases at all. To use XCFrameworks with Carthage, you need to pass in --use-xcframeworks.

carthage update --use-xcframeworks

More information on using XCFrameworks with Carthage is available at https://github.com/carthage/Carthage/#building-platform-independent-xcframeworks-xcode-12-and-above

โš ๏ธ

Under certain configurations, when debugging your app, using po to print objects to the console might result in an error \"Couldn't IRGen Expression\". If you run into this, one workaround is to add a single, empty Objective-C file to your project, and create a bridging header. There's more information on this issue here

Carthage with regular frameworksโ€‹

Run:

carthage update

Import the SDKโ€‹

๐Ÿ“˜Objective-C Only Projects

You may need to add an empty Swift file and a bridging header to your project before compiling.

You should now be able to import RevenueCat.

import RevenueCat
๐Ÿ“˜Enable In-App Purchase capability for your project

Don't forget to enable the In-App Purchase capability for your project under Project Target -> Capabilities -> In-App Purchase

Next Stepsโ€‹