mirror of
https://github.com/zhigang1992/react-native-code-push.git
synced 2026-06-15 18:37:55 +08:00
33 lines
1.4 KiB
Objective-C
33 lines
1.4 KiB
Objective-C
#import "AppDelegate.h"
|
|
#import "CodePush.h"
|
|
#import "RCTBundleURLProvider.h"
|
|
#import "RCTRootView.h"
|
|
|
|
@implementation AppDelegate
|
|
|
|
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
|
{
|
|
NSURL *jsCodeLocation;
|
|
|
|
// Use React Native's RCTBundleURLProvider to resolve your JS bundle location, so that your app will load the JS bundle from the packager server during development.
|
|
//jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];
|
|
|
|
// Use CodePush to resolve your JS bundle location, so that your app will run the version of the code distributed via CodePush
|
|
jsCodeLocation = [CodePush bundleURL];
|
|
|
|
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
|
|
moduleName:@"CodePushDemoApp"
|
|
initialProperties:nil
|
|
launchOptions:launchOptions];
|
|
rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
|
|
|
|
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
|
UIViewController *rootViewController = [UIViewController new];
|
|
rootViewController.view = rootView;
|
|
self.window.rootViewController = rootViewController;
|
|
[self.window makeKeyAndVisible];
|
|
return YES;
|
|
}
|
|
|
|
@end
|