diff options
| author | Joel Fischer <joeljfischer@gmail.com> | 2016-09-01 14:57:16 -0400 |
|---|---|---|
| committer | Joel Fischer <joeljfischer@gmail.com> | 2016-09-01 14:57:16 -0400 |
| commit | 0b347bd2502cede9b2017b0a096a1a9c6d475988 (patch) | |
| tree | a05001f06187d39b17ef1ff249beed5689df195b /SmartDeviceLink_Example/Classes | |
| parent | 6763aed5c4f6e3047c23a1e3fb137fe250ab4b5f (diff) | |
| download | sdl_ios-0b347bd2502cede9b2017b0a096a1a9c6d475988.tar.gz | |
Do a better job in the example app of starting the manager
Diffstat (limited to 'SmartDeviceLink_Example/Classes')
| -rw-r--r-- | SmartDeviceLink_Example/Classes/ProxyManager.m | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/SmartDeviceLink_Example/Classes/ProxyManager.m b/SmartDeviceLink_Example/Classes/ProxyManager.m index af868d09a..efde33663 100644 --- a/SmartDeviceLink_Example/Classes/ProxyManager.m +++ b/SmartDeviceLink_Example/Classes/ProxyManager.m @@ -61,7 +61,7 @@ typedef NS_ENUM(NSUInteger, SDLHMIFirstState) { SDLConfiguration *config = [SDLConfiguration configurationWithLifecycle:lifecycleConfig lockScreen:[SDLLockScreenConfiguration enabledConfiguration]]; self.sdlManager = [[SDLManager alloc] initWithConfiguration:config delegate:self]; - [self.sdlManager startWithReadyHandler:[[self readyBlock] copy]]; + [self startManager]; } - (void)startTCP { @@ -69,19 +69,20 @@ typedef NS_ENUM(NSUInteger, SDLHMIFirstState) { SDLConfiguration *config = [SDLConfiguration configurationWithLifecycle:lifecycleConfig lockScreen:[SDLLockScreenConfiguration enabledConfiguration]]; self.sdlManager = [[SDLManager alloc] initWithConfiguration:config delegate:self]; - [self.sdlManager startWithReadyHandler:[[self readyBlock] copy]]; + [self startManager]; } -- (SDLManagerReadyBlock)readyBlock { - return ^(BOOL success, NSError * _Nullable error) { +- (void)startManager { + __weak typeof (self) weakSelf = self; + [self.sdlManager startWithReadyHandler:^(BOOL success, NSError * _Nullable error) { if (!success) { NSLog(@"SDL errored starting up: %@", error); } - if ([self.sdlManager.hmiLevel isEqualToEnum:[SDLHMILevel FULL]]) { - [self showInitialData]; + if ([weakSelf.sdlManager.hmiLevel isEqualToEnum:[SDLHMILevel FULL]]) { + [weakSelf showInitialData]; } - }; + }]; } - (void)reset { |
