From ce35ebc40ec0040abd20b91a7489514de467daf0 Mon Sep 17 00:00:00 2001 From: "pengfei.zhou" Date: Mon, 9 Dec 2019 14:10:45 +0800 Subject: [PATCH] feat:update init script --- scripts/init.js | 5 +++-- target/iOS/Example/SceneDelegate.m | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/init.js b/scripts/init.js index 147a79ee..43ebdfd0 100644 --- a/scripts/init.js +++ b/scripts/init.js @@ -117,8 +117,9 @@ function initiOS(path, name) { return console.error(err); } copyFolder(`${targetiOSPath}`, `${path}`, () => { - const mainFiles = `Example/ViewController.m` - fs.writeFileSync(`${path}/${mainFiles}`, fs.readFileSync(`${targetiOSPath}/${mainFiles}`).toString().replace(/__\$__/g, name)) + ['Example/SceneDelegate.m', 'Example/AppDelegate.m'].forEach(e => { + fs.writeFileSync(`${path}/${e}`, fs.readFileSync(`${targetiOSPath}/${e}`).toString().replace(/__\$__/g, name)) + }) console.log(`Create Doric iOS Project Success`) }) }) diff --git a/target/iOS/Example/SceneDelegate.m b/target/iOS/Example/SceneDelegate.m index 887249c6..f00f2e90 100644 --- a/target/iOS/Example/SceneDelegate.m +++ b/target/iOS/Example/SceneDelegate.m @@ -7,7 +7,7 @@ @interface SceneDelegate () @implementation SceneDelegate - (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions { UIWindowScene *windowScene = (UIWindowScene *) scene; - NSString *bundleName = @"mcd"; + NSString *bundleName = @"__$__"; DoricViewController *doricViewController = [[DoricViewController alloc] initWithScheme:[NSString stringWithFormat:@"assets://src/%@.js", bundleName] alias:bundleName]; doricViewController.view.backgroundColor = [UIColor whiteColor]; UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:doricViewController];