我在App Store和Play商店中发布了本机(v0.59.9)应用程序。 react-native-code-push
库已成功添加到这些初始App Store提交的二进制文件中。
我的目标是实际开始使用代码推送服务器。为此,Microsoft的文档会说:
对于React Native 0.59-0.59.10:找到以下代码行,设置用于生产版本的网桥的源URL:目标-c
return [[NSBundle mainBundle]
URLForResource:@"main"withExtension:@"jsbundle";
用此行替换:
return [CodePush bundleURL];
但是我的项目是RN-v0.59.9,而我的appDelegate.m文件看起来像这样:
#import "AppDelegate.h"
#import <CodePush/CodePush.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <ReactNativeNavigation/ReactNativeNavigation.h>
#import "SplashScreen.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSURL *jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
[ReactNativeNavigation bootstrap:jsCodeLocation launchOptions:launchOptions];
[SplashScreen show];
return YES;
}
@end
为了完全集成该库,我需要进行哪些更改?
您可以使用[CodePush bundleURL]
代替[[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]
请参考example app以获取更多信息。