summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Fischer <joeljfischer@gmail.com>2016-03-16 10:10:15 -0400
committerJoel Fischer <joeljfischer@gmail.com>2016-03-16 10:10:15 -0400
commit19b852fa357e8fa2c30747696410d1a29ff775b6 (patch)
tree5f71df7a75866ab70870f7abaef52594baa0dc17
parentfc734a7a0e3ce053bc035cd8b1208dbf97fb1c7a (diff)
parent7ab8a233805a5e71b515798c57459713c5a03835 (diff)
downloadsdl_ios-19b852fa357e8fa2c30747696410d1a29ff775b6.tar.gz
Merge branch 'hotfix/issue_371'
-rw-r--r--SmartDeviceLink-iOS/SmartDeviceLink/SDLGlobals.h2
-rw-r--r--SmartDeviceLink-iOS/SmartDeviceLink/SDLProxy.m8
-rw-r--r--SmartDeviceLink-iOS/SmartDeviceLink/SDLStreamingMediaManager.m3
3 files changed, 11 insertions, 2 deletions
diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SDLGlobals.h b/SmartDeviceLink-iOS/SmartDeviceLink/SDLGlobals.h
index 03bc9afed..b3778f62e 100644
--- a/SmartDeviceLink-iOS/SmartDeviceLink/SDLGlobals.h
+++ b/SmartDeviceLink-iOS/SmartDeviceLink/SDLGlobals.h
@@ -8,6 +8,8 @@
#import <Foundation/Foundation.h>
+#define SDL_SYSTEM_VERSION_LESS_THAN(version) ([[[UIDevice currentDevice] systemVersion] compare:version options:NSNumericSearch] == NSOrderedAscending)
+
@interface SDLGlobals : NSObject
@property (assign, nonatomic, readonly) NSUInteger protocolVersion;
diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SDLProxy.m b/SmartDeviceLink-iOS/SmartDeviceLink/SDLProxy.m
index 00246ddfe..00e197a32 100644
--- a/SmartDeviceLink-iOS/SmartDeviceLink/SDLProxy.m
+++ b/SmartDeviceLink-iOS/SmartDeviceLink/SDLProxy.m
@@ -362,7 +362,13 @@ const int POLICIES_CORRELATION_ID = 65535;
[SDLDebugTool logInfo:[NSString stringWithFormat:@"Launch App failure: invalid URL sent from module: %@", request.url] withType:SDLDebugType_RPC toOutput:SDLDebugOutput_All toGroup:self.debugConsoleGroupName];
return;
}
-
+ // If system version is less than 9.0 http://stackoverflow.com/a/5337804/1370927
+ if (SDL_SYSTEM_VERSION_LESS_THAN(@"9.0")) {
+ // Return early if we can't openURL because openURL will crash instead of fail silently in < 9.0
+ if (![[UIApplication sharedApplication] canOpenURL:URLScheme]) {
+ return;
+ }
+ }
[[UIApplication sharedApplication] openURL:URLScheme];
}
diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SDLStreamingMediaManager.m b/SmartDeviceLink-iOS/SmartDeviceLink/SDLStreamingMediaManager.m
index a3b784f9b..62682c9dc 100644
--- a/SmartDeviceLink-iOS/SmartDeviceLink/SDLStreamingMediaManager.m
+++ b/SmartDeviceLink-iOS/SmartDeviceLink/SDLStreamingMediaManager.m
@@ -11,6 +11,7 @@
@import UIKit;
#import "SDLAbstractProtocol.h"
+#import "SDLGlobals.h"
NSString *const SDLErrorDomainStreamingMediaVideo = @"com.sdl.streamingmediamanager.video";
@@ -63,7 +64,7 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark - Streaming media lifecycle
- (void)startVideoSessionWithStartBlock:(SDLStreamingStartBlock)startBlock {
- if ([[[UIDevice currentDevice] systemVersion] floatValue] < 8.0) {
+ if (SDL_SYSTEM_VERSION_LESS_THAN(@"8.0")) {
NSAssert(NO, @"SDL Video Sessions can only be run on iOS 8+ devices");
startBlock(NO, [NSError errorWithDomain:SDLErrorDomainStreamingMediaVideo code:SDLSTreamingVideoErrorInvalidOperatingSystemVersion userInfo:nil]);