12345678910111213141516171819202122232425262728293031323334353637383940
  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 <AVFoundation/AVFoundation.h>
  13. @implementation AppDelegate
  14. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  15. {
  16. NSURL *jsCodeLocation;
  17. jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];
  18. RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
  19. moduleName:@"ViewShotExample"
  20. initialProperties:nil
  21. launchOptions:launchOptions];
  22. rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
  23. self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  24. UIViewController *rootViewController = [UIViewController new];
  25. rootViewController.view = rootView;
  26. self.window.rootViewController = rootViewController;
  27. [self.window makeKeyAndVisible];
  28. [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient error:nil];
  29. return YES;
  30. }
  31. @end