Getting Started
ReferralHero iOS Swift SDK
Getting Started
To start using the ReferralHero SDK, you will need to add it to your project as a framework. These can be downloaded from Here: https://github.com/maitre-app/ReferralHero-iOS
Manually
Step 1.
1. Visit the ReferralHero iOS SDK repository on GitHub: (https://github.com/maitre-app/ReferralHero-iOS).
2. You can either clone the repository using Git or download the ZIP file directly from GitHub. To clone, use the terminal with the command: `git clone https://github.com/maitre-app/ReferralHero-iOS.git`. If downloading the ZIP, extract it to a known location on your system.
Step 2.
1. Open your Xcode project.
2. Right-click on your project navigator and select "Add Files to [YourProjectName]".
3. Navigate to the location where you cloned or extracted the ReferralHero SDK. You should add the entire `ReferralHero.framework` to your project. Make sure "Copy items if needed" is checked so the framework is copied into your project directory.
Step 2.
1. Select your project in the Project Navigator to bring up the project settings.
2. Select your target and go to the "General" tab.
3. Scroll down to "Frameworks, Libraries, and Embedded Content".
4. Make sure `ReferralHero.framework` is listed and set to "Embed & Sign". This ensures the framework will be embedded into your app's bundle.
Step 3.
Import ReferralHero in AppDelegate.swift
If there is no AppDelegate, where @main
identifier is present in App function
Step 4.
Import ReferralHero in AppDelegate.swift.
, Or where @main
identifier is present in App function.
Get your API_TOKEN from the ReferralHero Dashboard -> API : https://app.referralhero.com/dashboard/apis
Back in the ReferralHero overview, click to edit your desired Campaign
Then the Installation tab, then Mobile App Installation
Get your UUID: The 12-letter ID that starts with ‘MF’ in Edit Campaign > launch > Mobile app installation, e.g. MF15298bba6d
Now, you should add The Campaign Token Obtained from the campaign, and UUID from the installation Tab.
Step 5.
In the Goal section of your Campaign settings, ensure you have added the Google Play and Apple App Store links and a default referral link for desktop web users.
Well done! You should now be able to build and run your campaign. Before using the more advanced features of the SDK, you should learn about a couple of important concepts.
There are a few major components in the SDK that you can include in your app.
Tracking Referrals
Now that you have implemented the SDK, you can start identifying and tracking referrals!
For that, you will need 2 things:
Universal Link
Your Integrated App
The RH SDK Pulls information from your Device, like this:
With this information, you should be able to add the subscriber data, with the Get Referrer, Add Subscriber, Create Pending Referral, or Track Referral methods to automatically identify or track a referral:
To further understand the implementation of these methods, please check the Public Methods section, and our Github Sample Project.
Last updated