AppDelegate.m 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /**
  2. * Copyright (c) Facebook, Inc. and its affiliates.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. */
  7. #import "AppDelegate.h"
  8. #import <React/RCTBridge.h>
  9. #import <React/RCTBundleURLProvider.h>
  10. #import <React/RCTRootView.h>
  11. #import <React/RCTLinkingManager.h>
  12. @implementation AppDelegate
  13. // ios 8.x or older
  14. - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
  15. sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
  16. {
  17. return [RCTLinkingManager application:application openURL:url
  18. sourceApplication:sourceApplication annotation:annotation];
  19. }
  20. // ios 9.0+
  21. - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
  22. options:(NSDictionary<NSString*, id> *)options
  23. {
  24. return [RCTLinkingManager application:application openURL:url options:options];
  25. }
  26. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  27. {
  28. RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
  29. RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
  30. moduleName:@"TaxControlApp"
  31. initialProperties:nil];
  32. rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
  33. self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  34. UIViewController *rootViewController = [UIViewController new];
  35. rootViewController.view = rootView;
  36. self.window.rootViewController = rootViewController;
  37. [self.window makeKeyAndVisible];
  38. return YES;
  39. }
  40. - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
  41. {
  42. #if DEBUG
  43. return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
  44. #else
  45. // return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
  46. return [NSURL URLWithString:[[NSBundle mainBundle] pathForResource:@"index.ios.jsbundle" ofType:nil]];
  47. #endif
  48. }
  49. @end