Skip to content

Commit 7fed0be

Browse files
authored
fix(message): Fix openURL freeze on iOS10 (#88) LP-5219
Use the newer openURL for iOS10+
1 parent 520415c commit 7fed0be

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Leanplum-SDK/Classes/LPMessageTemplates.m

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,12 @@ - (void)defineActions
323323
withResponder:^BOOL(LPActionContext *context) {
324324
@try {
325325
dispatch_async(dispatch_get_main_queue(), ^{
326-
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[context stringNamed:LPMT_ARG_URL]]];
326+
NSURL *url = [NSURL URLWithString:[context stringNamed:LPMT_ARG_URL]];
327+
if ([[UIApplication sharedApplication] respondsToSelector:@selector(openURL:options:completionHandler:)]) {
328+
[[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil];
329+
} else {
330+
[[UIApplication sharedApplication] openURL:url];
331+
}
327332
});
328333
return YES;
329334
}

0 commit comments

Comments
 (0)