@@ -55,7 +55,7 @@ Attached to the release you will find two framework bundles.
55
55
56
56
# Initializing the SDK
57
57
** Note:** Sample projects are included in this repo.
58
-
58
+
59
59
- [ Swift Sample Project] ( ./sample-apps/swift-sample-app )
60
60
- [ ObjC Sample Project] ( ./sample-apps/objc-sample-app )
61
61
@@ -145,7 +145,7 @@ Congratulations! You can now send remote push notifications to your device from
145
145
```
146
146
147
147
2 . ##### Deep Linking
148
-
148
+
149
149
* Handling Links from Push Notifications
150
150
151
151
Push notifications and action buttons may have `openUrl` actions attached to them. When a URL is specified, the SDK first calls `urlDelegate` specified in your `IterableConfig` object. You can use this delegate to handle `openUrl` actions the same way as you handle normal deep links. If the delegate is not set or if it returns `false` (the default), the SDK will open Safari with that URL. If you want to navigate to a UIViewController on receiving a deep link, you should do so in the `urlDelegate`.
@@ -164,30 +164,30 @@ Congratulations! You can now send remote push notifications to your device from
164
164
IterableAPI.initialize(apiKey: apiKey, launchOptions:launchOptions, config: config)
165
165
...
166
166
}
167
-
167
+
168
168
// Iterable URL Delegate. It will be called when you receive
169
169
// an `openUrl` event from push notification.
170
170
func handle(iterableURL url: URL, inContext context: IterableActionContext) -> Bool {
171
- return DeeplinkHandler.handle(url: url)
171
+ return DeeplinkHandler.handle(url: url)
172
172
}
173
173
```
174
174
175
175
Objective-C:
176
176
177
177
```objective-c
178
178
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
179
- ...
180
- // Initialize Iterable SDK
181
- IterableConfig *config = [[IterableConfig alloc] init];
182
- ...
179
+ ...
180
+ // Initialize Iterable SDK
181
+ IterableConfig *config = [[IterableConfig alloc] init];
182
+ ...
183
183
config.urlDelegate = self;
184
- [IterableAPI initializeWithApiKey:@"YOUR API KEY" launchOptions:launchOptions config:config];
185
- ...
184
+ [IterableAPI initializeWithApiKey:@"YOUR API KEY" launchOptions:launchOptions config:config];
185
+ ...
186
186
}
187
187
188
188
- (BOOL)handleIterableURL:(NSURL *)url context:(IterableActionContext *)context {
189
- // Assuming you have a DeeplinkHandler class that handles all deep link URLs and navigates to the right place in the app
190
- return [DeeplinkHandler handleUrl:url];
189
+ // Assuming you have a DeeplinkHandler class that handles all deep link URLs and navigates to the right place in the app
190
+ return [DeeplinkHandler handleUrl:url];
191
191
}
192
192
```
193
193
@@ -202,12 +202,12 @@ Congratulations! You can now send remote push notifications to your device from
202
202
203
203
```swift
204
204
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool {
205
- guard let url = userActivity.webpageURL else {
206
- return false
207
- }
205
+ guard let url = userActivity.webpageURL else {
206
+ return false
207
+ }
208
208
209
- // This will track the click, retrieve the original URL and call `handleIterableURL:context:` with the original URL
210
- return IterableAPI.handle(universalLink: url)
209
+ // This will track the click, retrieve the original URL and call `handleIterableURL:context:` with the original URL
210
+ return IterableAPI.handle(universalLink: url)
211
211
}
212
212
213
213
@@ -216,9 +216,9 @@ Congratulations! You can now send remote push notifications to your device from
216
216
Objective-C:
217
217
218
218
```objective-c
219
- - (BOOL)application:(UIApplication *)application continueUserActivity(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *restorableObjects))restorationHandler {
220
- // This will track the click, retrieve the original URL and call `handleIterableURL:context:` with the original URL
221
- return [IterableAPI handleUniversalLink:userActivity.webpageURL];
219
+ - (BOOL)application:(UIApplication *)application continueUserActivity(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *restorableObjects))restorationHandler {
220
+ // This will track the click, retrieve the original URL and call `handleIterableURL:context:` with the original URL
221
+ return [IterableAPI handleUniversalLink:userActivity.webpageURL];
222
222
}
223
223
```
224
224
@@ -228,29 +228,29 @@ Congratulations! You can now send remote push notifications to your device from
228
228
229
229
```swift
230
230
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool {
231
- guard let url = userActivity.webpageURL else {
232
- return false
233
- }
234
-
235
- IterableAPI.getAndTrack(deeplink: url) { (originalUrl) in
236
- // Handle original url deeplink here
237
- }
238
- return true
231
+ guard let url = userActivity.webpageURL else {
232
+ return false
233
+ }
234
+
235
+ IterableAPI.getAndTrack(deeplink: url) { (originalUrl) in
236
+ // Handle original url deeplink here
237
+ }
238
+ return true
239
239
}
240
240
```
241
241
242
242
Objective-C:
243
243
244
244
```objective-c
245
245
- (BOOL)application:(UIApplication *)application
246
- continueUserActivity(NSUserActivity *)userActivity
247
- restorationHandler:(void (^)(NSArray *restorableObjects))restorationHandler {
248
-
249
- [IterableAPI getAndTrackDeeplink:iterableLink callbackBlock:^(NSString* originalURL) {
250
- //Handle Original URL deeplink here
251
- }];
252
-
253
- return true;
246
+ continueUserActivity(NSUserActivity *)userActivity
247
+ restorationHandler:(void (^)(NSArray *restorableObjects))restorationHandler {
248
+
249
+ [IterableAPI getAndTrackDeeplink:iterableLink callbackBlock:^(NSString* originalURL) {
250
+ //Handle Original URL deeplink here
251
+ }];
252
+
253
+ return true;
254
254
}
255
255
```
256
256
@@ -282,7 +282,7 @@ Iterable SDK provides an implementation that handles media attachments and actio
282
282
```
283
283
// If the target name for the notification extension is 'MyAppNotificationExtension'
284
284
target 'MyAppNotificationExtension' do
285
- pod 'IterableAppExtensions'
285
+ pod 'IterableAppExtensions'
286
286
end
287
287
```
288
288
@@ -313,13 +313,13 @@ Objective-C: You can not inherit in case of Objective C. You will have to delega
313
313
314
314
@implementation NotificationService
315
315
- (void)didReceiveNotificationRequest:(UNNotificationRequest * )request withContentHandler:(void (^)(UNNotificationContent * _ Nonnull))contentHandler {
316
-
317
- self.baseExtension = [[ ITBNotificationServiceExtension alloc] init] ;
318
- [ self.baseExtension didReceiveNotificationRequest: request withContentHandler: contentHandler ] ;
316
+
317
+ self.baseExtension = [[ITBNotificationServiceExtension alloc] init];
318
+ [self.baseExtension didReceiveNotificationRequest:request withContentHandler:contentHandler];
319
319
}
320
320
321
321
- (void)serviceExtensionTimeWillExpire {
322
- [ self.baseExtension serviceExtensionTimeWillExpire] ;
322
+ [self.baseExtension serviceExtensionTimeWillExpire];
323
323
}
324
324
@end
325
325
0 commit comments