Get Started: iOS¶
Install Repro SDK¶
CocoaPods (Recommended)¶
Repro is available via CocoaPods.
Add the following line to your Podfile.
target 'YOUR-PROJECT-NAME' do
pod "Repro"
end
And run the following command:
$ pod install
When the Repro SDK is installed successfully, open the YOUR-PROJECT-NAME.xcworkspace
and setup Repro.
Swift Package Manager¶
Open the Swift Package Manager package selection menu via File > Add Packages... (Older Xcode versions open this menu via File > Swift Packages > Add Package Dependency...).
The Repro iOS SDK can be selected by inserting the repository URL https://github.com/reproio/repro-ios-sdk
into the search box.
After pressing Add Package
twice, the SDK should be added successfully to the App project. The correct installation can be verified in the project settings.
Warning
The download of the SDK after clicking on Add Packages
can take several minutes with current versions of Xcode (~13.0), because the whole repository will be cloned to the local Swift Package Manager cache. We assume this behavior changes in the future.
Download and Install Repro SDK¶
If you don't use CocoaPods or the Swift Package Manager, you can download the latest release version of Repro-iOS-SDK and install it manually.
After moving Repro.xcframework
from the downloaded .zip file into your project directory structure, the framework can be added into your Xcode project via File > Add Files to "AppName".
Required Frameworks¶
Finally the iOS system frameworks listed below must also be added to your project at Targets > Build Phases > Link Binary With Libraries.
- SystemConfiguration.framework
- WebKit.framework
- UserNotifications.framework
Note
Currently the Repro SDK does not support the new App Clips
feature released with iOS 14. Please do not link the Repro SDK with an App Clips
app.
Setup¶
Import Repro
in your AppDelegate
and start a new session in application:didFinishLaunchingWithOptions:
You can find the YOUR_APP_TOKEN
at SDK Token in SETTINGS > PROJECT SETTINGS on the management screen.
#import <Repro/Repro.h>
...
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
...
// Setup Repro
[Repro setup:@"YOUR_APP_TOKEN"];
...
}
import Repro
...
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
...
// Setup Repro
Repro.setup(token: "YOUR_APP_TOKEN")
// Call the following methods to use Repro's features; they can be called in any desirable place within the app.
...
}
Information collected by the SDK will be uploaded to the server periodically.
Track event¶
Targeting the right group of users is critical to effectively make analyses or marketing campaigns. By keeping track of user behavior as events, you will be able to choose the right group of users according to your purpose from the dashboard.
Example of targeting user group with events:
If you don't exactly know which events to track in your app, we recommend you to start from tracking the event when each view is displayed.
Example:
@implementation MainViewController
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
[Repro track:@"MainViewController" properties:nil];
...
}
class MainViewController: UIViewController {
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
Repro.track(event: "MainViewController", properties: [:])
...
}
public class MainActivity extends AppCompatActivity {
@Override
protected void onResume() {
super.onResume();
Repro.track("MainActivity");
...
}
}
#include "ReproCpp.h"
...
ReproCpp::track("Initialized");
Repro.Track ("Initialized");
// Will be written later
class MainScreen extends React.Component {
componentDidMount() {
Repro.track("MainScreen", {});
}
...
}
import 'package:repro_flutter/repro.dart';
...
await Repro.track("Initialized");
Set User ID¶
The analytics results you will see in Repro are aggregated per each user. By setting the User ID, you gain the advantages below:
Identify the same user across multiple devices
Target campaigns more accurately
Please see here for more details.
Send push notifications¶
You can send push notifications from Repro's dashboard as well as using the API. Please refer to this document when implementing push notification.
Next...¶
For more details of other available features, please see below.