Skip to content

Commit

Permalink
- Crash Fix - This release fixes a crash on versions of our SDK 2.0.0…
Browse files Browse the repository at this point in the history
… and newer on iOS 10 devices. This crash occurs when an iOS 10 user launches the app by tapping on a notification with a Launch URL, if you have set kOSSettingsKeyInAppAlerts to `false` (default is `true`). Please update to this SDK release or newer to resolve this issue.

- Fixed an issue where the notificationAction block would be called twice on iOS 10 devices when a user tapped on a notification.
  • Loading branch information
Joseph Kalash committed Aug 24, 2016
1 parent fd228c4 commit 137add7
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 12 deletions.
2 changes: 1 addition & 1 deletion OneSignal.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "OneSignal"
s.version = "2.0.10"
s.version = "2.0.11"
s.summary = "OneSignal push notification library for mobile apps."
s.homepage = "https://onesignal.com"
s.license = { :type => 'MIT', :file => 'LICENSE' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ framework module OneSignal {
umbrella header "OneSignal.h"
export *
module * { export * }
}
}
Binary file modified iOS_SDK/Framework/OneSignal.framework/Versions/A/OneSignal
Binary file not shown.
Binary file modified iOS_SDK/Framework/OneSignal.framework/Versions/B/OneSignal
Binary file not shown.
21 changes: 13 additions & 8 deletions iOS_SDK/OneSignal/OneSignal.m
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@

@implementation OneSignal

NSString* const ONESIGNAL_VERSION = @"020010";
NSString* const ONESIGNAL_VERSION = @"020011";

static bool registeredWithApple = false; //Has attempted to register for push notifications with Apple.
static OneSignalTrackIAP* trackIAPPurchase;
Expand Down Expand Up @@ -177,16 +177,22 @@ + (id)initWithLaunchOptions:(NSDictionary*)launchOptions appId:(NSString*)appId

[OneSignalTracker onFocus:NO];
}

/*
* No need to call the handleNotificationOpened:userInfo as it will be called from the
* application:didReceiveRemoteNotification:fetchCompletionHandler / userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler (i10)
*/

//If app opened from tap on notification or action
/*
NSDictionary* userInfo = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
if(userInfo) {
OSNotificationActionType type = Opened;
if(userInfo[@"custom"][@"a"][@"actionSelected"] || userInfo[@"actionSelected"])
type = ActionTaken;
[self handleNotificationOpened:userInfo isActive:NO actionType:type displayType:Notification];
}
*/
[self clearBadgeCount:false];

if ([OneSignalTrackIAP canTrack])
Expand Down Expand Up @@ -785,7 +791,7 @@ + (void)notificationOpened:(NSDictionary*)messageDict isActive:(BOOL)isActive {
}
else {

//app was in background and opened due to a tap on a notification or an action check what type
//app was in background / not running and opened due to a tap on a notification or an action check what type
NSString* actionSelected = NULL;
OSNotificationActionType type = Opened;
if(messageDict[@"custom"][@"a"][@"actionSelected"]) {
Expand Down Expand Up @@ -835,12 +841,11 @@ + (void) handleNotificationOpened:(NSDictionary*)messageDict isActive:(BOOL)isAc
+ (void)launchWebURL:(NSString*)openUrl {

if (openUrl) {
if ([OneSignalHelper verifyURL:openUrl])
if ([OneSignalHelper verifyURL:openUrl]) {
//Create a dleay to allow alertview to dismiss before showing anything or going to safari
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.5 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
NSURL *url = [NSURL URLWithString:openUrl];
[OneSignalHelper displayWebView:url];
});
NSURL *url = [NSURL URLWithString:openUrl];
[OneSignalHelper performSelector:@selector(displayWebView:) withObject:url afterDelay:0.5];
}
}

}
Expand Down
4 changes: 2 additions & 2 deletions iOS_SDK/OneSignalMobileProvision/OneSignalMobileProvision.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

@implementation OneSignalMobileProvision

/** embedded.mobileprovision plist format:
/**
embedded.mobileprovision plist format:
AppIDName, // string - TextDetective
ApplicationIdentifierPrefix[], // [ string - 66PK3K3KEV ]
CreationData, // date - 2013-01-17T14:18:05Z
Expand Down
5 changes: 5 additions & 0 deletions iOS_SDK/OneSignalWebView.m
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,12 @@ -(void)showInApp {
if(!viewControllerForPresentation.view.superview)
[mainWindow addSubview:[viewControllerForPresentation view]];

@try {
[viewControllerForPresentation presentViewController:navController animated:YES completion:NULL];
}
@catch(NSException* exception) {
NSLog(@"%@", exception);
}
}


Expand Down

0 comments on commit 137add7

Please sign in to comment.