From f0de868a34f734c65936236923ff3d05be93271f Mon Sep 17 00:00:00 2001 From: "pengfei.zhou" Date: Thu, 28 Nov 2019 14:43:53 +0800 Subject: [PATCH] feat:iOS simulator support devkit --- iOS/Example/Example/ViewController.m | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/iOS/Example/Example/ViewController.m b/iOS/Example/Example/ViewController.m index 6110d39c..8acb2e3e 100644 --- a/iOS/Example/Example/ViewController.m +++ b/iOS/Example/Example/ViewController.m @@ -53,9 +53,19 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N return cell; } +- (BOOL)isSimulator { + return TARGET_OS_SIMULATOR == 1; +} + - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.row == 0) { - [self.navigationController pushViewController:[QRScanViewController new] animated:NO]; + if (self.isSimulator) { + NSString *result = @"127.0.0.1"; + [[DoricDriver instance] connectDevKit:[NSString stringWithFormat:@"ws://%@:7777", result]]; + ShowToast([NSString stringWithFormat:@"Connected to %@", result], BOTTOM); + } else { + [self.navigationController pushViewController:[QRScanViewController new] animated:NO]; + } return; } NSString *file = self.demoFilePaths[(NSUInteger) indexPath.row];