AppDelegate.m 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /**
  2. * Copyright (c) 2015-present, Facebook, Inc.
  3. * All rights reserved.
  4. *
  5. * This source code is licensed under the BSD-style license found in the
  6. * LICENSE file in the root directory of this source tree. An additional grant
  7. * of patent rights can be found in the PATENTS file in the same directory.
  8. */
  9. #import "AppDelegate.h"
  10. #import <React/RCTBundleURLProvider.h>
  11. #import <React/RCTRootView.h>
  12. #import <React/RCTLinkingManager.h>
  13. @implementation AppDelegate
  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. // Only if your app is using [Universal Links](https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/AppSearch/UniversalLinks.html).
  21. - (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity
  22. restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler
  23. {
  24. return [RCTLinkingManager application:application
  25. continueUserActivity:userActivity
  26. restorationHandler:restorationHandler];
  27. }
  28. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  29. {
  30. NSURL *jsCodeLocation;
  31. jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
  32. RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
  33. moduleName:@"idly"
  34. initialProperties:nil
  35. launchOptions:launchOptions];
  36. rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
  37. self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  38. UIViewController *rootViewController = [UIViewController new];
  39. rootViewController.view = rootView;
  40. self.window.rootViewController = rootViewController;
  41. [self.window makeKeyAndVisible];
  42. return YES;
  43. }
  44. @end