11
11
#import < UIKit/UIKit.h>
12
12
13
13
#if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0
14
- #error This version (2.2) of the Intercom iOS SDK supports iOS 7.0 upwards.
14
+ #error This version (2.2.1 ) of the Intercom iOS SDK supports iOS 7.0 upwards.
15
15
#endif
16
16
17
17
// Use these values to constrain an incoming notification view to a defined section of the window.
@@ -31,49 +31,49 @@ typedef NS_ENUM(NSUInteger, ICMPreviewPosition){
31
31
In order to see your users in Intercom's user list, you must first register them via your iOS application. If you have a
32
32
place in your application where you become aware of the user's identity such as a log in view controller, call one of the
33
33
following depending on the information you have available for that user:
34
-
34
+
35
35
If you have both a unique user identifier and an email for your users::
36
36
37
- [Intercom registerUserWithUserId:@"123456" email:@"[email protected] "];
37
+ [Intercom registerUserWithUserId:@"123456" email:@"[email protected] "];
38
38
39
39
If you only have a unique identifier for your users:
40
40
41
- [Intercom registerUserWithUserId:@"123456"];
41
+ [Intercom registerUserWithUserId:@"123456"];
42
42
43
43
Finally, if you only have an email address for your users:
44
-
45
- [Intercom registerUserWithEmail:@"[email protected] "];
44
+
45
+ [Intercom registerUserWithEmail:@"[email protected] "];
46
46
47
47
## Can I track unidentified users?
48
48
49
49
Yes, absolutely. If you have an application that doesn't require users to log in, you can call:
50
50
51
- [Intercom registerUnidentifiedUser];
51
+ [Intercom registerUnidentifiedUser];
52
52
53
- If the user subsequently logs in or you learn additional information about them (e.g. get an email address),
54
- calling any of the other user registration methods will update that user's identity in Intercom and contain
53
+ If the user subsequently logs in or you learn additional information about them (e.g. get an email address),
54
+ calling any of the other user registration methods will update that user's identity in Intercom and contain
55
55
all user data tracked previously.
56
56
57
57
## I'm using a previous SDK version and this looks different, what has changed?
58
58
59
59
We have re-architected the internals of the iOS SDK to ensure it is as reliable as possible while tracking
60
60
your users. We have focused on removing the asynchronous behaviour of the SDK. For example you no longer need
61
- to wait for the completion blocks of the old `beginSession` calls before logging events or updating user data.
61
+ to wait for the completion blocks of the old `beginSession` calls before logging events or updating user data.
62
62
In doing so the SDK is more nimble and reliable than ever before.
63
63
64
- Previous versions of the SDK will migrate with minimal effort. All deprecated methods still work for now,
64
+ Previous versions of the SDK will migrate with minimal effort. All deprecated methods still work for now,
65
65
excluding the old session listener (since v2.0.6). These methods will be permanently removed in a future
66
66
version.
67
67
68
68
## How do push notifications work?
69
69
70
70
The Intercom iOS SDK enables your users to receive push notifications for new messages. Simply call:
71
71
72
- - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
73
- [Intercom setDeviceToken:deviceToken];
74
- }
72
+ - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
73
+ [Intercom setDeviceToken:deviceToken];
74
+ }
75
75
76
- in your `didRegisterForRemoteNotificationsWithDeviceToken:` method once you have registered your app for
76
+ in your `didRegisterForRemoteNotificationsWithDeviceToken:` method once you have registered your app for
77
77
push notifications with the `UIApplicationDelegate`.
78
78
79
79
When your app receives a push notification the SDK checks to see if it is an Intercom push notification
@@ -84,7 +84,7 @@ typedef NS_ENUM(NSUInteger, ICMPreviewPosition){
84
84
85
85
## More information
86
86
87
- Full documentation is available [here](http://docs.intercom.io/Install-on-your-mobile-product) and please contact
87
+ Full documentation is available [here](http://docs.intercom.io/Install-on-your-mobile-product) and please contact
88
88
us directly via Intercom for any support or questions you may have.
89
89
90
90
*/
@@ -123,7 +123,7 @@ typedef NS_ENUM(NSUInteger, ICMPreviewPosition){
123
123
/* !
124
124
If you call registerUnidentifiedUser, all activity will be tracked anonymously. If you choose to subsequently
125
125
identify that user, all that anonymous activity will be merged into the identified user. This means that you
126
- will no longer see the anonymous user in Intercom, but rather the identified one.
126
+ will no longer see the anonymous user in Intercom, but rather the identified one.
127
127
128
128
We recommend this is called from within the application delegate's didFinishLaunchingWithOptions: method.
129
129
@@ -171,49 +171,49 @@ typedef NS_ENUM(NSUInteger, ICMPreviewPosition){
171
171
/* ! @name Resetting user data */
172
172
// =========================================================================================================
173
173
/* !
174
- reset is used to reset all local caches and user data the Intercom SDK has created. Use this at a time when
175
- you wish to log a user out of your app or change a user. Once called, the SDK will no longer communicate with Intercom
176
- until a further registration is made.
174
+ reset is used to reset all local caches and user data the Intercom SDK has created. Reset will also close
175
+ and active UI that is on screen. Use this at a time when you wish to log a user out of your app or change
176
+ a user. Once called, the SDK will no longer communicate with Intercom until a further registration is made.
177
177
*/
178
178
+ (void )reset ;
179
179
180
180
// =========================================================================================================
181
181
/* * @name Updating the user */
182
182
// =========================================================================================================
183
183
/* !
184
- You can send any data you like to Intercom. Typically our customers see a lot of value in sending data that
184
+ You can send any data you like to Intercom. Typically our customers see a lot of value in sending data that
185
185
relates to customer development, such as price plan, value of purchases, etc. Once these have been sent to
186
186
Intercom you can then apply filters based on these attributes.
187
187
188
188
A detailed list of the fields you can use to [update a user is available here](https://doc.intercom.io/api/#user-model)
189
189
190
190
Attributes such as the user email or name can be updated by calling
191
191
192
- [Intercom updateUserWithAttributes:@{
193
-
194
- @"name" : @"Admin Name"
195
- }];
192
+ [Intercom updateUserWithAttributes:@{
193
+
194
+ @"name" : @"Admin Name"
195
+ }];
196
196
197
197
Custom user attributes can be created and modified by passing a custom_attributes dictionary
198
198
You do not have to create attributes in Intercom beforehand. If one hasn't been seen before, it will be
199
199
created for you automatically.
200
200
201
- [Intercom updateUserWithAttributes:@{
202
- @"custom_attributes": @{
203
- @"paid_subscriber" : @YES,
204
- @"monthly_spend": @155.5,
205
- @"team_mates": @3
206
- }
207
- }];
201
+ [Intercom updateUserWithAttributes:@{
202
+ @"custom_attributes": @{
203
+ @"paid_subscriber" : @YES,
204
+ @"monthly_spend": @155.5,
205
+ @"team_mates": @3
206
+ }
207
+ }];
208
208
209
209
You can also set company data via this call by submitting an attribute dictionary like
210
210
211
- [Intercom updateUserWithAttributes:@{
212
- @"companies": @[ @{
213
- @"name" : @"My Company",
214
- @"id" : @"abcd1234"
215
- }
216
- ]}];
211
+ [Intercom updateUserWithAttributes:@{
212
+ @"companies": @[ @{
213
+ @"name" : @"My Company",
214
+ @"id" : @"abcd1234"
215
+ }
216
+ ]}];
217
217
218
218
id is a required field for adding or modifying a company. A detailed description of the
219
219
[company model is available here](https://doc.intercom.io/api/#companies-and--users)
@@ -226,9 +226,9 @@ typedef NS_ENUM(NSUInteger, ICMPreviewPosition){
226
226
/* !
227
227
Log an event with a given name.
228
228
229
- You can log events in Intercom based on user actions in your app. Events are different
230
- to custom user attributes in that events are information on what Users did and when they
231
- did it, whereas custom user attributes represent the User's current state as seen in their
229
+ You can log events in Intercom based on user actions in your app. Events are different
230
+ to custom user attributes in that events are information on what Users did and when they
231
+ did it, whereas custom user attributes represent the User's current state as seen in their
232
232
profile. See details about Events [here](http://doc.intercom.io/api/#events).
233
233
234
234
@param name The name of the event that it is going to be logged.
@@ -239,13 +239,13 @@ typedef NS_ENUM(NSUInteger, ICMPreviewPosition){
239
239
Metadata Objects support a few simple types that Intercom can present on your behalf, see the
240
240
[Intercom API docs](http://doc.intercom.io/api/#event-metadata-types)
241
241
242
- [Intercom logEventWithName:@"ordered_item" metaData:@{
243
- @"order_date": @1392036272,
244
- @"stripe_invoice": @"inv_3434343434",
245
- @"order_number": @{
246
- @"value": @"3434-3434",
247
- @"url": @"https://example.org/orders/3434-3434"
248
- }];
242
+ [Intercom logEventWithName:@"ordered_item" metaData:@{
243
+ @"order_date": @1392036272,
244
+ @"stripe_invoice": @"inv_3434343434",
245
+ @"order_number": @{
246
+ @"value": @"3434-3434",
247
+ @"url": @"https://example.org/orders/3434-3434"
248
+ }];
249
249
250
250
@param name The name of the event you wish to track.
251
251
@param metaData contains simple types to present to Intercom
@@ -291,7 +291,7 @@ typedef NS_ENUM(NSUInteger, ICMPreviewPosition){
291
291
+ (void )setPreviewPosition : (ICMPreviewPosition)previewPosition ;
292
292
293
293
/* !
294
- Depending on the layout of your app you may need to modify the position of the message preview relative to the
294
+ Depending on the layout of your app you may need to modify the position of the message preview relative to the
295
295
preview's position. Use this method to add sufficient padding using x and y values.
296
296
297
297
@param x A horizontal padding value.
@@ -305,7 +305,8 @@ typedef NS_ENUM(NSUInteger, ICMPreviewPosition){
305
305
306
306
/* !
307
307
Use this to hide all incoming Intercom messages and message previews in the parts of your app where you do
308
- not wish to interrupt users, for example Camera views, parts of a game or other scenarios.
308
+ not wish to interrupt users, for example Camera views, parts of a game or other scenarios. If any part of the
309
+ SDK's UI is on screen when this is set to YES, it will close itself.
309
310
310
311
@param hidden A bool that toggles message visibility. Use this to either prevent or allow messages from being
311
312
displayed in select parts of your app.
@@ -354,9 +355,9 @@ typedef NS_ENUM(NSUInteger, ICMPresentationMode){
354
355
ICMPresentationModeTopRight = 3
355
356
};
356
357
357
- /* *
358
- @warning Deprecated methods will be removed in version 2.4.
359
- */
358
+ /* *
359
+ @warning Deprecated methods will be removed in version 2.4.
360
+ */
360
361
@interface Intercom (Deprecated)
361
362
362
363
typedef void (^ICMCompletion)(NSError *error) __attribute((deprecated));
@@ -441,6 +442,4 @@ typedef void(^ICMCompletion)(NSError *error) __attribute((deprecated));
441
442
*/
442
443
+ (void )registerForRemoteNotifications __attribute((deprecated(" Use method 'setDeviceToken' instead." )));
443
444
444
- @end
445
-
446
-
445
+ @end
0 commit comments