如何在 Xcode 中包装集成Microsoft Appcenter 的代码推送



我在App Store和Play Store上发布了一个react原生(v0.59.9(应用程序。react-native-code-push库已成功添加到这些初始应用商店提交的二进制文件中。

我的目标是真正开始使用代码推送服务器。要做到这一点,微软的文档说:

对于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]

有关详细信息,请参阅示例应用程序。

最新更新