From 0aafdf4b56da5fc9ab1eb06abdb97f2a2c3bf7bc Mon Sep 17 00:00:00 2001 From: sunnylqm Date: Tue, 12 Mar 2024 19:22:27 +0800 Subject: [PATCH] Refactor sourceURLForBridge and didFinishLaunchingWithOptions methods --- site/pages/docs/getting-started.mdx | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/site/pages/docs/getting-started.mdx b/site/pages/docs/getting-started.mdx index ed49cb7..6a7289c 100644 --- a/site/pages/docs/getting-started.mdx +++ b/site/pages/docs/getting-started.mdx @@ -139,31 +139,17 @@ date +%s > "$DEST/pushy_build_time.txt" // #endif -// 如果RN版本 >= 0.59,修改sourceURLForBridge +// 修改sourceURLForBridge方法 - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge { #if DEBUG - // 原先这里的写法继续保留(所以debug模式下不可热更新) - return ..... + // 原先DEBUG这里的写法不作修改(所以DEBUG模式下不可热更新) + return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"]; #else -  // 把这里非DEBUG的情况替换为热更新bundle的写法 - return [RCTPushy bundleURL]; + return [RCTPushy bundleURL]; // <-- 把这里非DEBUG的情况替换为热更新bundle #endif } -// 如果RN版本 < 0.59,修改didFinishLaunchingWithOptions -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions -{ -#if DEBUG -  // 原来的jsCodeLocation保留在这里(所以debug模式下不可热更新) -  jsCodeLocation = .......... -#else -  // 把这里非DEBUG的情况替换为热更新bundle的写法 -  jsCodeLocation = [RCTPushy bundleURL]; -#endif - // ... 其它代码 -} - ``` #### Android