diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2017-01-26 13:44:17 -0500 |
---|---|---|
committer | Joel Fischer <joeljfischer@gmail.com> | 2017-01-26 13:44:17 -0500 |
commit | ba88adaa93565111fc27585cfbb92c92e0c7eebc (patch) | |
tree | fc2b7ce2014d314c572f0c6c67bc59f1a39318e3 | |
parent | 0511464160dd539b58961fc85516ab76e2bbeb81 (diff) | |
download | sdl_ios-ba88adaa93565111fc27585cfbb92c92e0c7eebc.tar.gz |
Re-add reconnecting state
6 files changed, 79 insertions, 52 deletions
diff --git a/SmartDeviceLink-iOS.xcodeproj/project.pbxproj b/SmartDeviceLink-iOS.xcodeproj/project.pbxproj index ba0d62d08..e36936373 100644 --- a/SmartDeviceLink-iOS.xcodeproj/project.pbxproj +++ b/SmartDeviceLink-iOS.xcodeproj/project.pbxproj @@ -4292,6 +4292,7 @@ TargetAttributes = { 5D4019AE1A76EC350006B0C2 = { CreatedOnToolsVersion = 6.1.1; + DevelopmentTeam = ACNGAAM3M7; SystemCapabilities = { com.apple.BackgroundModes = { enabled = 1; @@ -5167,6 +5168,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_IDENTITY = "iPhone Developer"; + DEVELOPMENT_TEAM = ACNGAAM3M7; INFOPLIST_FILE = "$(SRCROOT)/SmartDeviceLink_Example/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -5180,6 +5182,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_IDENTITY = "iPhone Developer"; + DEVELOPMENT_TEAM = ACNGAAM3M7; INFOPLIST_FILE = "$(SRCROOT)/SmartDeviceLink_Example/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; diff --git a/SmartDeviceLink/SDLLifecycleManager.h b/SmartDeviceLink/SDLLifecycleManager.h index 927b5cfbb..9332d5d9d 100644 --- a/SmartDeviceLink/SDLLifecycleManager.h +++ b/SmartDeviceLink/SDLLifecycleManager.h @@ -38,6 +38,7 @@ NS_ASSUME_NONNULL_BEGIN typedef NSString SDLLifecycleState; extern SDLLifecycleState *const SDLLifecycleStateStopped; extern SDLLifecycleState *const SDLLifecycleStateStarted; +extern SDLLifecycleState *const SDLLifecycleStateReconnecting; extern SDLLifecycleState *const SDLLifecycleStateConnected; extern SDLLifecycleState *const SDLLifecycleStateRegistered; extern SDLLifecycleState *const SDLLifecycleStateSettingUpManagers; diff --git a/SmartDeviceLink/SDLLifecycleManager.m b/SmartDeviceLink/SDLLifecycleManager.m index ff17864a8..74770169e 100644 --- a/SmartDeviceLink/SDLLifecycleManager.m +++ b/SmartDeviceLink/SDLLifecycleManager.m @@ -45,6 +45,7 @@ NS_ASSUME_NONNULL_BEGIN SDLLifecycleState *const SDLLifecycleStateStopped = @"Stopped"; SDLLifecycleState *const SDLLifecycleStateStarted = @"Started"; +SDLLifecycleState *const SDLLifecycleStateReconnecting = @"Reconnecting"; SDLLifecycleState *const SDLLifecycleStateConnected = @"Connected"; SDLLifecycleState *const SDLLifecycleStateRegistered = @"Registered"; SDLLifecycleState *const SDLLifecycleStateSettingUpManagers = @"SettingUpManagers"; @@ -61,7 +62,6 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready"; @property (strong, nonatomic, readwrite) SDLNotificationDispatcher *notificationDispatcher; @property (strong, nonatomic, readwrite) SDLResponseDispatcher *responseDispatcher; @property (strong, nonatomic, readwrite) SDLStateMachine *lifecycleStateMachine; -@property (assign, nonatomic, readwrite, getter=shouldRestartProxy) BOOL restartProxy; // Private properties @property (copy, nonatomic) SDLManagerReadyBlock readyHandler; @@ -82,8 +82,6 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready"; if (!self) { return nil; } - - _restartProxy = YES; // Dependencies _configuration = configuration; @@ -116,7 +114,6 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready"; } - (void)stop { - _restartProxy = NO; if ([self.lifecycleStateMachine isCurrentState:SDLLifecycleStateReady]) { [self.lifecycleStateMachine transitionToState:SDLLifecycleStateUnregistering]; } else { @@ -141,20 +138,18 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready"; + (NSDictionary<SDLState *, SDLAllowableStateTransitions *> *)sdl_stateTransitionDictionary { return @{ SDLLifecycleStateStopped: @[SDLLifecycleStateStarted], - SDLLifecycleStateStarted : @[SDLLifecycleStateConnected, SDLLifecycleStateStopped], - SDLLifecycleStateConnected: @[SDLLifecycleStateStopped, SDLLifecycleStateRegistered], - SDLLifecycleStateRegistered: @[SDLLifecycleStateStopped, SDLLifecycleStateSettingUpManagers], - SDLLifecycleStateSettingUpManagers: @[SDLLifecycleStateStopped, SDLLifecycleStatePostManagerProcessing], - SDLLifecycleStatePostManagerProcessing: @[SDLLifecycleStateStopped, SDLLifecycleStateReady], + SDLLifecycleStateStarted : @[SDLLifecycleStateConnected, SDLLifecycleStateStopped, SDLLifecycleStateReconnecting], + SDLLifecycleStateReconnecting: @[SDLLifecycleStateStarted], + SDLLifecycleStateConnected: @[SDLLifecycleStateStopped, SDLLifecycleStateReconnecting, SDLLifecycleStateRegistered], + SDLLifecycleStateRegistered: @[SDLLifecycleStateStopped, SDLLifecycleStateReconnecting, SDLLifecycleStateSettingUpManagers], + SDLLifecycleStateSettingUpManagers: @[SDLLifecycleStateStopped, SDLLifecycleStateReconnecting, SDLLifecycleStatePostManagerProcessing], + SDLLifecycleStatePostManagerProcessing: @[SDLLifecycleStateStopped, SDLLifecycleStateReconnecting, SDLLifecycleStateReady], SDLLifecycleStateUnregistering: @[SDLLifecycleStateStopped], - SDLLifecycleStateReady: @[SDLLifecycleStateUnregistering, SDLLifecycleStateStopped] + SDLLifecycleStateReady: @[SDLLifecycleStateUnregistering, SDLLifecycleStateStopped, SDLLifecycleStateReconnecting] }; } - (void)didEnterStateStarted { - // We will always try to restart the proxy, unless stop is called. - _restartProxy = YES; - // Set up our logging capabilities based on the config [self.class sdl_updateLoggingWithFlags:self.configuration.lifecycleConfig.logFlags]; @@ -170,6 +165,14 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready"; } - (void)didEnterStateStopped { + [self sdl_stopManager:NO]; +} + +- (void)didEnterStateReconnecting { + [self sdl_stopManager:YES]; +} + +- (void)sdl_stopManager:(BOOL)shouldRestart { [self.fileManager stop]; [self.permissionManager stop]; [self.lockScreenManager stop]; @@ -180,13 +183,13 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready"; self.hmiLevel = nil; [self sdl_disposeProxy]; // call this method instead of stopProxy to avoid double-dispatching - + // Due to a race condition internally with EAStream, we cannot immediately attempt to restart the proxy, as we will randomly crash. // Apple Bug ID #30059457 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [self.delegate managerDidDisconnect]; - - if (self.shouldRestartProxy) { + + if (shouldRestart) { [self.lifecycleStateMachine transitionToState:SDLLifecycleStateStarted]; } }); @@ -209,7 +212,6 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready"; if (error != nil || ![response.success boolValue]) { [SDLDebugTool logFormat:@"Failed to register the app. Error: %@, Response: %@", error, response]; weakSelf.readyHandler(NO, error); - _restartProxy = NO; [weakSelf.lifecycleStateMachine transitionToState:SDLLifecycleStateStopped]; return; } @@ -439,7 +441,11 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready"; } - (void)transportDidDisconnect { - [self.lifecycleStateMachine transitionToState:SDLLifecycleStateStopped]; + if (self.lifecycleState == SDLLifecycleStateUnregistering || self.lifecycleState == SDLLifecycleStateStopped) { + [self.lifecycleStateMachine transitionToState:SDLLifecycleStateStopped];; + } else { + [self.lifecycleStateMachine transitionToState:SDLLifecycleStateReconnecting]; + } } - (void)hmiStatusDidChange:(SDLRPCNotificationNotification *)notification { @@ -466,7 +472,13 @@ SDLLifecycleState *const SDLLifecycleStateReady = @"Ready"; SDLOnAppInterfaceUnregistered *appUnregisteredNotification = notification.notification; [SDLDebugTool logFormat:@"Remote Device forced unregistration for reason: %@", appUnregisteredNotification.reason]; - [self.lifecycleStateMachine transitionToState:SDLLifecycleStateStopped]; + if ([self.lifecycleStateMachine isCurrentState:SDLLifecycleStateUnregistering]) { + [self.lifecycleStateMachine transitionToState:SDLLifecycleStateStopped]; + } else if ([self.lifecycleStateMachine isCurrentState:SDLLifecycleStateStopped]) { + return; + } else { + [self.lifecycleStateMachine transitionToState:SDLLifecycleStateReconnecting]; + } } @end diff --git a/SmartDeviceLink_Example/Base.lproj/ConnectionIAPTableViewController.storyboard b/SmartDeviceLink_Example/Base.lproj/ConnectionIAPTableViewController.storyboard index 335364997..d8a88f6de 100644 --- a/SmartDeviceLink_Example/Base.lproj/ConnectionIAPTableViewController.storyboard +++ b/SmartDeviceLink_Example/Base.lproj/ConnectionIAPTableViewController.storyboard @@ -1,8 +1,13 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="7706" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="J12-ul-Tx1"> +<?xml version="1.0" encoding="UTF-8"?> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="J12-ul-Tx1"> + <device id="retina4_7" orientation="portrait"> + <adaptation id="fullscreen"/> + </device> <dependencies> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/> + <deployment identifier="iOS"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/> <capability name="Constraints to layout margins" minToolsVersion="6.0"/> + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> <scenes> <!--ConnectionIAP Table View Controller--> @@ -10,22 +15,24 @@ <objects> <tableViewController id="J12-ul-Tx1" customClass="ConnectionIAPTableViewController" sceneMemberID="viewController"> <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" id="MzB-GZ-Ook"> - <rect key="frame" x="0.0" y="0.0" width="600" height="600"/> + <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> - <color key="backgroundColor" red="0.93725490196078431" green="0.93725490196078431" blue="0.95686274509803926" alpha="1" colorSpace="calibratedRGB"/> + <color key="backgroundColor" red="0.93725490196078431" green="0.93725490196078431" blue="0.95686274509803926" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <sections> <tableViewSection id="Qz3-D9-j37"> <cells> <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="2sd-U1-9xV"> + <rect key="frame" x="0.0" y="35" width="375" height="44"/> <autoresizingMask key="autoresizingMask"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="2sd-U1-9xV" id="EhZ-2E-WQ5"> + <rect key="frame" x="0.0" y="0.0" width="375" height="44"/> <autoresizingMask key="autoresizingMask"/> <subviews> - <button opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="rjq-vZ-OjB"> - <rect key="frame" x="0.0" y="0.0" width="600" height="44"/> + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="rjq-vZ-OjB"> + <rect key="frame" x="8" y="0.0" width="359" height="44"/> <fontDescription key="fontDescription" type="system" pointSize="23"/> <state key="normal" title="Connect"> - <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/> + <color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> </state> <connections> <action selector="connectButtonWasPressed:" destination="J12-ul-Tx1" eventType="touchUpInside" id="95T-fc-kXs"/> @@ -35,8 +42,8 @@ <constraints> <constraint firstItem="rjq-vZ-OjB" firstAttribute="top" secondItem="EhZ-2E-WQ5" secondAttribute="top" id="8GY-v0-41a"/> <constraint firstAttribute="bottom" secondItem="rjq-vZ-OjB" secondAttribute="bottom" id="FKB-JG-o5G"/> - <constraint firstAttribute="trailingMargin" secondItem="rjq-vZ-OjB" secondAttribute="trailing" constant="-8" id="ISQ-6b-S34"/> - <constraint firstItem="rjq-vZ-OjB" firstAttribute="leading" secondItem="EhZ-2E-WQ5" secondAttribute="leadingMargin" constant="-8" id="PiJ-h3-NOR"/> + <constraint firstAttribute="trailingMargin" secondItem="rjq-vZ-OjB" secondAttribute="trailing" id="ISQ-6b-S34"/> + <constraint firstItem="rjq-vZ-OjB" firstAttribute="leading" secondItem="EhZ-2E-WQ5" secondAttribute="leadingMargin" id="PiJ-h3-NOR"/> </constraints> </tableViewCellContentView> </tableViewCell> diff --git a/SmartDeviceLink_Example/Base.lproj/ConnectionTCPTableViewController.storyboard b/SmartDeviceLink_Example/Base.lproj/ConnectionTCPTableViewController.storyboard index 231cff68b..63324d6de 100644 --- a/SmartDeviceLink_Example/Base.lproj/ConnectionTCPTableViewController.storyboard +++ b/SmartDeviceLink_Example/Base.lproj/ConnectionTCPTableViewController.storyboard @@ -1,31 +1,35 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9531" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="l5Q-ZP-1BO"> +<?xml version="1.0" encoding="UTF-8"?> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="l5Q-ZP-1BO"> + <device id="retina4_7" orientation="portrait"> + <adaptation id="fullscreen"/> + </device> <dependencies> <deployment identifier="iOS"/> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/> <capability name="Constraints to layout margins" minToolsVersion="6.0"/> + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> <scenes> <!--ConnectionTCP Table View Controller--> <scene sceneID="geJ-kX-PTm"> <objects> <tableViewController id="l5Q-ZP-1BO" customClass="ConnectionTCPTableViewController" sceneMemberID="viewController"> - <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="grouped" separatorStyle="default" showsSelectionImmediatelyOnTouchBegin="NO" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" id="7ZH-AV-Zyf"> - <rect key="frame" x="0.0" y="0.0" width="600" height="600"/> + <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" id="7ZH-AV-Zyf"> + <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> - <color key="backgroundColor" red="0.93725490196078431" green="0.93725490196078431" blue="0.95686274509803926" alpha="1" colorSpace="calibratedRGB"/> + <color key="backgroundColor" red="0.93725490196078431" green="0.93725490196078431" blue="0.95686274509803926" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <sections> <tableViewSection headerTitle="TCP Server" id="bF6-yi-Ial"> <cells> <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="pbJ-oz-jNt"> - <rect key="frame" x="0.0" y="50" width="600" height="44"/> + <rect key="frame" x="0.0" y="56" width="375" height="44"/> <autoresizingMask key="autoresizingMask"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="pbJ-oz-jNt" id="B7X-yY-lwJ"> - <rect key="frame" x="0.0" y="0.0" width="600" height="43"/> + <rect key="frame" x="0.0" y="0.0" width="375" height="43"/> <autoresizingMask key="autoresizingMask"/> <subviews> <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="IP Address" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="xqM-s4-9RV"> - <rect key="frame" x="8" y="0.0" width="584" height="44"/> + <rect key="frame" x="8" y="0.0" width="359" height="44"/> <constraints> <constraint firstAttribute="height" constant="44" id="5Pw-mh-x83"/> </constraints> @@ -41,14 +45,14 @@ </tableViewCellContentView> </tableViewCell> <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="C5b-fS-v3d"> - <rect key="frame" x="0.0" y="94" width="600" height="44"/> + <rect key="frame" x="0.0" y="100" width="375" height="44"/> <autoresizingMask key="autoresizingMask"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="C5b-fS-v3d" id="ZD4-xA-og5"> - <rect key="frame" x="0.0" y="0.0" width="600" height="43"/> + <rect key="frame" x="0.0" y="0.0" width="375" height="43"/> <autoresizingMask key="autoresizingMask"/> <subviews> <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="Port" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="hsI-ld-8xY"> - <rect key="frame" x="8" y="0.0" width="584" height="44"/> + <rect key="frame" x="8" y="0.0" width="359" height="44"/> <constraints> <constraint firstAttribute="height" constant="44" id="FpG-5e-MHT"/> </constraints> @@ -68,17 +72,17 @@ <tableViewSection headerTitle="" id="rgl-Lm-uDH"> <cells> <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="ybX-Eh-Hbx"> - <rect key="frame" x="0.0" y="158" width="600" height="44"/> + <rect key="frame" x="0.0" y="164" width="375" height="44"/> <autoresizingMask key="autoresizingMask"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="ybX-Eh-Hbx" id="uI9-fK-205"> - <rect key="frame" x="0.0" y="0.0" width="600" height="43"/> + <rect key="frame" x="0.0" y="0.0" width="375" height="43"/> <autoresizingMask key="autoresizingMask"/> <subviews> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="tailTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="t37-4W-6F4"> - <rect key="frame" x="0.0" y="0.0" width="600" height="43"/> + <rect key="frame" x="8" y="0.0" width="359" height="43"/> <fontDescription key="fontDescription" type="system" pointSize="23"/> <state key="normal" title="Connect"> - <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/> + <color key="titleShadowColor" red="0.5" green="0.5" blue="0.5" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> </state> <connections> <action selector="connectButtonWasPressed:" destination="l5Q-ZP-1BO" eventType="touchUpInside" id="tgb-10-M4m"/> @@ -87,9 +91,9 @@ </subviews> <constraints> <constraint firstItem="t37-4W-6F4" firstAttribute="top" secondItem="uI9-fK-205" secondAttribute="top" id="IfU-4k-EXx"/> - <constraint firstItem="t37-4W-6F4" firstAttribute="leading" secondItem="uI9-fK-205" secondAttribute="leadingMargin" constant="-8" id="cc3-uk-9fL"/> + <constraint firstItem="t37-4W-6F4" firstAttribute="leading" secondItem="uI9-fK-205" secondAttribute="leadingMargin" id="cc3-uk-9fL"/> <constraint firstAttribute="bottom" secondItem="t37-4W-6F4" secondAttribute="bottom" id="hnD-4g-xvT"/> - <constraint firstAttribute="trailingMargin" secondItem="t37-4W-6F4" secondAttribute="trailing" constant="-8" id="j4p-fi-0LP"/> + <constraint firstAttribute="trailingMargin" secondItem="t37-4W-6F4" secondAttribute="trailing" id="j4p-fi-0LP"/> </constraints> </tableViewCellContentView> </tableViewCell> diff --git a/SmartDeviceLink_Example/Classes/ConnectionIAPTableViewController.m b/SmartDeviceLink_Example/Classes/ConnectionIAPTableViewController.m index 0b0a785cc..17ee2ae19 100644 --- a/SmartDeviceLink_Example/Classes/ConnectionIAPTableViewController.m +++ b/SmartDeviceLink_Example/Classes/ConnectionIAPTableViewController.m @@ -73,7 +73,7 @@ - (void)proxyManagerDidChangeState:(ProxyState)newState { UIColor* newColor = nil; NSString* newTitle = nil; - + switch (newState) { case ProxyStateStopped: { newColor = [UIColor redColor]; @@ -89,11 +89,11 @@ } break; default: break; } - - if (newColor && newTitle) { + + if (newColor || newTitle) { dispatch_async(dispatch_get_main_queue(), ^{ - self.connectTableViewCell.backgroundColor = newColor; - self.connectButton.titleLabel.text = newTitle; + [self.connectTableViewCell setBackgroundColor:newColor]; + [self.connectButton setTitle:newTitle forState:UIControlStateNormal]; }); } } |