Я обновил свою экспозицию и реагирую на нее, и теперь получаю сообщение «EXDevLauncher/ExpoDevLauncherAppDelegateSubscriber.swift:8: Неустранимая ошибка: невозможно найти ключевое окно. Обязательно вызовите window.makeKeyAndVisible()». при создании моего приложения в Xcode. Я пытался решить эту проблему, каким-то образом изменив файл AppDelegate.m, но это не сработало. Вот файлы AppDelegate и SceneDelegate. Я узнал, что они могут быть причиной этого, поэтому публикую их здесь, но если потребуются дополнительные файлы, дайте мне знать:`
#import
#import
#import
@interface AppDelegate : EXAppDelegateWrapper
@end
`
#import "AppDelegate.h"
// @generated begin react-native-maps-import - expo prebuild (DO NOT MODIFY) sync-f2f83125c99c0d74b42a2612947510c4e08c423a
#if __has_include()
#import
#endif
// @generated end react-native-maps-import
#import
#import
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
#if __has_include()
[GMSServices provideAPIKey:@"AIzaSyCDnK85Y_BEl8g-tdrdSl8eC2VGotnEB5k"];
#endif
self.moduleName = @"main";
self.initialProps = @{};
NSLog(@"[AppDelegate] didFinishLaunching begin");
// Call super but WITHOUT creating a window (SceneDelegate will do that)
BOOL result = [super application:application didFinishLaunchingWithOptions:launchOptions];
NSLog(@"[AppDelegate] didFinishLaunching end");
return result;
}
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
#else
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}
// Explicitly define remote notification delegates to ensure compatibility with some third-party libraries
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
return [super application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
}
// Explicitly define remote notification delegates to ensure compatibility with some third-party libraries
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
return [super application:application didFailToRegisterForRemoteNotificationsWithError:error];
}
// Explicitly define remote notification delegates to ensure compatibility with some third-party libraries
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
{
return [super application:application didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
}
@end
#import
#import "AppDelegate.h"
int main(int argc, char * argv[]) {
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
#import "SceneDelegate.h"
#import
#import
#import
#import "AppDelegate.h"
@implementation SceneDelegate
- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
if (![scene isKindOfClass:[UIWindowScene class]]) { return; }
UIWindowScene *windowScene = (UIWindowScene *)scene;
NSLog(@"[SceneDelegate] willConnectToSession");
// Create window for this scene
self.window = [[UIWindow alloc] initWithWindowScene:windowScene];
NSLog(@"[SceneDelegate] window created");
// Get AppDelegate for dev launcher delegate
AppDelegate *appDelegate = (AppDelegate *)UIApplication.sharedApplication.delegate;
// Make window visible AFTER dev launcher is initialized
[self.window makeKeyAndVisible];
NSLog(@"[SceneDelegate] window makeKeyAndVisible called");
// NOW start dev launcher with the window
NSLog(@"[SceneDelegate] EXDevLauncherController startWithWindow called");
EXDevLauncherController *controller = [EXDevLauncherController sharedInstance];
[controller startWithWindow:self.window delegate:appDelegate launchOptions:nil];
NSLog(@"[SceneDelegate] setup complete, window is key and visible");
}
- (void)sceneDidDisconnect:(UIScene *)scene {
NSLog(@"[SceneDelegate] sceneDidDisconnect");
}
- (void)sceneDidBecomeActive:(UIScene *)scene {
NSLog(@"[SceneDelegate] sceneDidBecomeActive");
}
- (void)sceneWillResignActive:(UIScene *)scene {
NSLog(@"[SceneDelegate] sceneWillResignActive");
}
- (void)sceneWillEnterForeground:(UIScene *)scene {
NSLog(@"[SceneDelegate] sceneWillEnterForeground");
}
- (void)sceneDidEnterBackground:(UIScene *)scene {
NSLog(@"[SceneDelegate] sceneDidEnterBackground");
}
@end
#import
#import "AppDelegate.h"
#import "SceneDelegate.h"
// This category supplies a UIScene configuration at runtime so the app
// uses SceneDelegate even if Info.plist doesn't declare UIApplicationSceneManifest.
@implementation AppDelegate (SceneConfiguration)
- (UISceneConfiguration *)application:(UIApplication *)application
configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession
options:(UISceneConnectionOptions *)options
{
UISceneConfiguration *config = [UISceneConfiguration configurationWithName:@"Default Configuration"
sessionRole:connectingSceneSession.role];
config.delegateClass = [SceneDelegate class];
return config;
}
- (void)application:(UIApplication *)application didDiscardSceneSessions:(NSSet *)sceneSessions
{
// No-op. Implemented to fully adopt UIScene lifecycle.
}
@end
Подробнее здесь: https://stackoverflow.com/questions/797 ... o-call-win