Skip to content

Commit 2405551

Browse files
author
Andy Scott
committed
Merge pull request #134 from intercom/as/sdk_migration_instructions
Updated readme file to include migrations instructions section
2 parents 27c85f4 + 558096f commit 2405551

File tree

1 file changed

+43
-18
lines changed

1 file changed

+43
-18
lines changed

README.md

Lines changed: 43 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ Intercom for iOS supports iOS 7.x, iOS 8.x and iOS 9.x.
77

88
### CocoaPods
99
Add the Intercom pod into your Podfile and run `pod install`.
10-
10+
1111
pod 'Intercom'
12-
13-
### Manual Installation
12+
13+
### Manual Installation
1414

1515
[Download Intercom for iOS](https://github.com/intercom/intercom-ios/archive/master.zip) and use Finder to drag `Intercom.framework` and `Intercom.bundle` into your Xcode project, ticking the "Copy items if needed" checkbox.
1616

@@ -45,26 +45,26 @@ No matter what category of app you have, you'll need your Intercom app id and th
4545
###My app only has logged in users
4646
1. Firstly, on successful completion of your authentication method in your login view controller you will need to register your user.
4747

48-
- (void)successfulLogin {
48+
- (void)successfulLogin {
4949
...
5050
// Registering with Intercom is easy. For best results, use a unique user_id if you have one.
5151
[Intercom registerUserWithUserId:@"<#123456#>"];
5252
}
5353
**Note:** _If you don't have a unique `userId` to use here, or if you have a `userId` and an `email` you can [register with those too](https://github.com/intercom/intercom-ios/blob/master/Intercom.framework/Versions/A/Headers/Intercom.h#L152)._
5454

55-
2. Also, in your application delegate's `didFinishLaunchingWithOptions:` method (or wherever you _check_ your user's authenticated state when your app starts up)
55+
2. Also, in your application delegate's `didFinishLaunchingWithOptions:` method (or wherever you _check_ your user's authenticated state when your app starts up)
5656

5757
// Override point for customization after application launch.
5858
if(loggedIn){
5959
...
6060
// We're logged in, we can register the user with Intercom
6161
[Intercom registerUserWithUserId:@"<#123456#>"];
62-
62+
6363
// Carry on as normal
6464
...
6565
}
6666
}
67-
67+
6868
3. Finally, when users eventually want to log out of your app, we should clear Intercom for iOS's caches so that when they log back in again, everything works perfectly. In your logout code, simply call `[Intercom reset];` like so:
6969

7070
- (void)logout {
@@ -83,41 +83,41 @@ No matter what category of app you have, you'll need your Intercom app id and th
8383
[Intercom registerUnidentifiedUser];
8484
...
8585
}
86-
86+
8787
Because Intercom listens for UIApplication start notifications, there is no need to have this line of code anywhere else. Intercom will track all of your user sessions for you.
8888

8989
###My app has logged in and logged out users
9090

9191
1. Firstly, on successful completion of your authentication method in your login view controller you will need to register your user.
9292

93-
- (void)successfulLogin {
93+
- (void)successfulLogin {
9494
...
9595
// Registering with Intercom is easy. For best results, use a unique user_id if you have one.
9696
[Intercom registerUserWithUserId:@"<#123456#>"];
9797
}
9898
**Note:** _If you don't have a unique `userId` to use here, or if you have a `userId` and an `email` you can [register with those too](https://github.com/intercom/intercom-ios/blob/master/Intercom.framework/Versions/A/Headers/Intercom.h#L152)._
9999

100-
2. In your application delegate's `didFinishLaunchingWithOptions:` method (or wherever you _check_ your user's authenticated state when your app starts up)
100+
2. In your application delegate's `didFinishLaunchingWithOptions:` method (or wherever you _check_ your user's authenticated state when your app starts up)
101101

102102
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
103103
if(loggedIn){
104104
...
105105
// We're logged in, we can register the user with Intercom
106106
[Intercom registerUserWithUserId:@"<#123456#>"];
107-
107+
108108
} else {
109109
// Since we aren't logged in, we are an unidentified user. Lets register.
110110
[Intercom registerUnidentifiedUser];
111111
}
112112
}
113-
113+
114114
3. Finally, when users eventually want to log out of your app, we should clear Intercom for iOS's caches so that when they log back in again, everything works perfectly. In your logout code, simply call `[Intercom reset];` like so:
115115

116116
- (void)logout {
117117
...
118118
// This reset's the Intercom integration's cache of your user's identity and wipes the slate clean.
119119
[Intercom reset];
120-
120+
121121
// Now that you have logged your user out and reset, you can register a new
122122
// unidentified user in their place.
123123
[Intercom registerUnidentifiedUser];
@@ -129,8 +129,8 @@ Because Intercom listens for UIApplication start notifications, there is no need
129129
1. **Do not use an email address as a `userId` as this field is unique and cannot be changed or updated later.** If you only have an email address, you can just register a user with that. [More details are available here](https://github.com/intercom/intercom-ios/blob/master/Intercom.framework/Versions/A/Headers/Intercom.h#L168).
130130
2. **If you register users with an email address, email must be a unique field in your app.** Otherwise we won't know which user to update and the mobile integration won't work.
131131
3. Intercom for iOS listens for when your app starts and stops, so all you need to do is register a type of user like the examples above and we'll do the rest.
132-
133-
132+
133+
134134
## How does the in-app messenger work?
135135

136136
Intercom allows you to send messages to your users while also enabling your users send messages to you. If you have a dedicated button in your app that you wish to hook the new message composer up to, you can control Intercom's messaging UI via the `[Intercom presentMessageComposer];` and `[Intercom presentConversationList];` methods. More information on messaging with Intercom for iOS can be found [here](http://docs.intercom.io/Install-on-your-mobile-product/configuring-intercom-for-ios#messaging).
@@ -139,15 +139,15 @@ Intercom allows you to send messages to your users while also enabling your user
139139

140140
Intercom for iOS has support for all these things. For full details please read our [documentation](http://docs.intercom.io/Install-on-your-mobile-product/configuring-intercom-for-ios).
141141

142-
142+
143143
## I'm using a previous version and this looks different, what's changed?
144-
144+
145145
We have re-architected Intercom for iOS to ensure it is as reliable as possible while tracking your users. We have focused on removing the asychronous behaviour of Intercom for iOS, for example you no longer need to wait for the completion blocks of the now deprecated `beginSession` calls before logging events or updating user data. In doing so it is more nimble and reliable than ever before.
146146

147147
Previous versions of Intercom for iOS will migrate with minimal effort. All deprecated methods still work for now, excluding the old session listener (since v2.0.6). These deprecated methods will be permanently removed in a future version.
148148

149149
## Documentation and getting started guides
150-
150+
151151
Detailed documentation and getting started guides for:
152152

153153
- Updating a user
@@ -163,3 +163,28 @@ are available in [our documentation](https://docs.intercom.io/configuring-for-yo
163163
## Xcode Documentation
164164

165165
This documentation provides integrated help in Xcode for all public APIs in Intercom for iOS. [Download the docset](https://github.com/intercom/intercom-ios/archive/master.zip) from the repository above and Copy the content into ~`/Library/Developer/Shared/Documentation/DocSets`.
166+
167+
168+
## Migrating to the latest version of the SDK
169+
170+
Migrating to the latest version of the iOS SDK should be a very straight forward and worthwhile process. There are two main ways you can update your SDK library version in your app.
171+
172+
1. Run `pod update Intercom` from the root of you Xcode project where your *Podfile* lives.
173+
2. Download the latest binary version of the SDK and include it in your app's dependency library directory.
174+
175+
As the SDK has evolved some method signatures have changed but their purpose has stayed the same. Here is a list of some of the more commonly used methods and their new names:
176+
177+
<table>
178+
<tr><th colspan="3" style="text-align:center;">iOS Method Name Changes</th></tr>
179+
<tr><td style="text-align:center; font-weight: bold; width: 33.3%;">Old Name</td><td style="text-align:center; font-weight: bold; width: 33.3%;">Type</td><td style="text-align:center; font-weight: bold; width: 33.3%;">New Name</td></tr>
180+
<tr><td colspan="3" style="text-align:center; font-weight: bold;">From SDK version 2.0.x to 2.3.19</td></tr>
181+
<tr><td>beginSessionForUserWithUserId</td><td>Name change. Dropped block parameter.</td><td>registerUserWithUserId</td></tr>
182+
<tr><td>beginSessionForUserWithEmail</td><td>Name change. Dropped block parameter.</td><td>registerUserWithEmail</td></tr>
183+
<tr><td>beginSessionForAnonymousUserWithCompletion</td><td>Name change. Dropped block parameter.</td><td>registerUnidentifiedUser</td></tr>
184+
<tr><td>updateUserWithAttributes</td><td>Dropped block parameter.</td><td>n/a</td></tr>
185+
<tr><td>logEventWithName</td><td>Dropped block parameter.</td><td>n/a</td></tr>
186+
<tr><td colspan="3" style="text-align:center; font-weight: bold;">From SDK version 1.x.x to 2.3.19</td></tr>
187+
<tr><td>beginSessionForUserWithUserId</td><td>Name change. Dropped block parameter.</td><td>registerUserWithUserId</td></tr>
188+
<tr><td>beginSessionForUserWithEmail</td><td>Name change. Dropped block parameter.</td><td>registerUserWithEmail</td></tr>
189+
<tr><td>updateAttributes</td><td>Name change. Dropped block parameter.</td><td>updateUserWithAttributes</td></tr>
190+
</table>

0 commit comments

Comments
 (0)