RudderStack's iOS SDK lets you track event data from your iOS applications. After integrating the SDK, you will be able to send the event data to your preferred destination/s such as Google Analytics, Amplitude, and more.
For detailed documentation on the iOS SDK, click here.
The iOS SDK is available through CocoaPods and Carthage.
To install the SDK, simply add the following line to your Podfile:
pod 'Rudder', '1.0.24'
For Carthage support, add the following line to your Cartfile
:
github "rudderlabs/rudder-sdk-ios" "v1.0.24"
Remember to include the following code in all
.m
and.h
files where you want to refer to or use the RudderStack SDK classes, as shown:
#import <Rudder/Rudder.h>
To the initialize RSClient
, place the following code in your AppDelegate.m
file under the method didFinishLaunchingWithOptions
:
RSConfigBuilder *builder = [[RSConfigBuilder alloc] init];
[builder withDataPlaneUrl:<DATA_PLANE_URL>];
[RSClient getInstance:<WRITE_KEY> config:[builder build]];
A shared instance of RSClient
is accesible after the initialization by [RSClient sharedInstance]
.
[[RSClient sharedInstance] track:@"simple_track_event"];
[[RSClient sharedInstance] track:@"simple_track_with_props" properties:@{
@"key_1" : @"value_1",
@"key_2" : @"value_2"
}];
[[RSClient sharedInstance] screen:@"Main" properties:@{@"prop_key" : @"prop_value"}];
[[RSClient sharedInstance] identify:@"test_user_id"
traits:@{@"foo": @"bar",
@"foo1": @"bar1",
@"email": @"[email protected]"}
];
[[RSClient sharedInstance] group:@"sample_group_id"
traits:@{@"foo": @"bar",
@"foo1": @"bar1",
@"email": @"[email protected]"}
];
[[RSClient sharedInstance] alias:@"new_user_id"];
[[RSClient sharedInstance] reset];
For detailed documentation, click here.
For more information on using the RudderStack iOS SDK, you can contact us or start a conversation on our Slack channel.