File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed
objc-sample-app/objc-sample-app
swift-sample-app/swift-sample-app Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -16,14 +16,16 @@ @interface AppDelegate ()
16
16
@end
17
17
18
18
@implementation AppDelegate
19
+ // IMP: Either email or userId must be set.
19
20
NSString *apiKey = @" " ; // set iterable api key here
20
21
NSString *email = @" " ; // set iterable email here
22
+ NSString *userId = @" " ;// set iterable userId here, either email or userId must be set
21
23
22
24
23
25
- (BOOL )application : (UIApplication *)application didFinishLaunchingWithOptions : (NSDictionary *)launchOptions {
24
26
// initial check
25
- if (apiKey.length == 0 || email.length == 0 ) {
26
- [NSException raise: @" Not Initialized" format: @" Iterable API key and email must be set." ];
27
+ if (apiKey.length == 0 || ( email.length == 0 && userId. length == 0 ) ) {
28
+ [NSException raise: @" Not Initialized" format: @" Iterable API key and either email or userId must be set." ];
27
29
}
28
30
29
31
// ITBL: Setup Notifications
@@ -115,7 +117,7 @@ - (BOOL)handleIterableCustomAction:(IterableAction *)action context:(IterableAct
115
117
if (action.userInput != nil ) {
116
118
NSString *urlString = [[NSString alloc ] initWithFormat: @" https://majumder.me/coffee?q=%@ " , action.userInput];
117
119
NSURL *url = [[NSURL alloc ] initWithString: urlString];
118
- [DeeplinkHandler handleURL: url];
120
+ return [DeeplinkHandler handleURL: url];
119
121
}
120
122
}
121
123
Original file line number Diff line number Diff line change @@ -14,15 +14,17 @@ import IterableSDK
14
14
@UIApplicationMain
15
15
class AppDelegate : UIResponder , UIApplicationDelegate {
16
16
// ITBL: replace with your api key and email.
17
+ // IMP: Either userId or email must be set.
17
18
let apiKey = " " // set Iterable api key here
18
19
let email = " " // set Iterable user email here.
20
+ let userId = " " // set iterable userId here. Either email or userId must be set.
19
21
20
22
var window : UIWindow ?
21
23
22
24
func application( _ application: UIApplication , didFinishLaunchingWithOptions launchOptions: [ UIApplicationLaunchOptionsKey : Any ] ? ) -> Bool {
23
25
// Initial check
24
- if apiKey. isEmpty || email. isEmpty {
25
- fatalError ( " Iterable API Key and email need to be set. " )
26
+ if apiKey. isEmpty || ( email. isEmpty && userId . isEmpty ) {
27
+ fatalError ( " Iterable API Key and either email or userId need to be set. " )
26
28
}
27
29
28
30
//ITBL: Setup Notification
@@ -138,7 +140,7 @@ extension AppDelegate : IterableCustomActionDelegate {
138
140
func handle( iterableCustomAction action: IterableAction , inContext context: IterableActionContext ) -> Bool {
139
141
if action. type == " handleFindCoffee " {
140
142
if let query = action. userInput {
141
- _ = DeeplinkHandler . handle ( url: URL ( string: " https://majumder.me/coffee?q= \( query) " ) !)
143
+ return DeeplinkHandler . handle ( url: URL ( string: " https://majumder.me/coffee?q= \( query) " ) !)
142
144
}
143
145
}
144
146
return false
You can’t perform that action at this time.
0 commit comments