AppDelegate.mm 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #import "AppDelegate.h"
  2. #import <React/RCTBundleURLProvider.h>
  3. #import <React/RCTLinkingManager.h>
  4. @implementation AppDelegate
  5. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  6. {
  7. self.moduleName = @"main";
  8. // You can add your custom initial props in the dictionary below.
  9. // They will be passed down to the ViewController used by React Native.
  10. self.initialProps = @{};
  11. return [super application:application didFinishLaunchingWithOptions:launchOptions];
  12. }
  13. - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
  14. {
  15. return [self bundleURL];
  16. }
  17. - (NSURL *)bundleURL
  18. {
  19. #if DEBUG
  20. return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@".expo/.virtual-metro-entry"];
  21. #else
  22. return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
  23. #endif
  24. }
  25. // Linking API
  26. - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
  27. return [super application:application openURL:url options:options] || [RCTLinkingManager application:application openURL:url options:options];
  28. }
  29. // Universal Links
  30. - (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler {
  31. BOOL result = [RCTLinkingManager application:application continueUserActivity:userActivity restorationHandler:restorationHandler];
  32. return [super application:application continueUserActivity:userActivity restorationHandler:restorationHandler] || result;
  33. }
  34. // Explicitly define remote notification delegates to ensure compatibility with some third-party libraries
  35. - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
  36. {
  37. return [super application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
  38. }
  39. // Explicitly define remote notification delegates to ensure compatibility with some third-party libraries
  40. - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
  41. {
  42. return [super application:application didFailToRegisterForRemoteNotificationsWithError:error];
  43. }
  44. // Explicitly define remote notification delegates to ensure compatibility with some third-party libraries
  45. - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
  46. {
  47. return [super application:application didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
  48. }
  49. @end