mirror of
https://github.com/movixcorp/MovixOpenSource.git
synced 2026-08-19 06:55:41 +00:00
iOS : corriger le crash au démarrage (super non implémenté)
RCTAppDelegate hérite de UIResponder et n'implémente NI applicationWillResignActive: NI applicationDidBecomeActive: (ce sont des méthodes optionnelles du protocole UIApplicationDelegate). Mes overrides appelaient [super ...] aveuglément, ce qui envoyait un sélecteur non reconnu dans la chaîne RCTAppDelegate → UIResponder → NSObject → "unrecognized selector sent to instance" → crash. applicationDidBecomeActive: étant appelé à CHAQUE lancement, l'app crashait systématiquement au démarrage, avant même l'init de React Native (donc avant la popup DNS). Correctif : n'appeler [super ...] que si la super-classe répond réellement au sélecteur (instancesRespondToSelector:_cmd), pour rester compatible si une future version de RN ajoute ces méthodes. https://claude.ai/code/session_01X52sah6aUu3ou26uJWHgzr
This commit is contained in:
parent
f7bf9e34dc
commit
47ebc3921b
1 changed files with 13 additions and 2 deletions
|
|
@ -52,7 +52,12 @@
|
|||
// webkitSetPresentationMode('picture-in-picture') synchronously for MSE/HLS.js.
|
||||
// This fires earlier and more reliably than AppState 'inactive' via the RN bridge.
|
||||
- (void)applicationWillResignActive:(UIApplication *)application {
|
||||
[super applicationWillResignActive:application];
|
||||
// RCTAppDelegate (UIResponder) n'implémente PAS applicationWillResignActive:.
|
||||
// Appeler [super ...] aveuglément envoie un sélecteur non reconnu → crash.
|
||||
// On ne relaie au super que s'il répond réellement au sélecteur.
|
||||
if ([[self superclass] instancesRespondToSelector:_cmd]) {
|
||||
[super applicationWillResignActive:application];
|
||||
}
|
||||
|
||||
// isViewLoaded avoids forcing viewDidLoad on an uninitialised VC.
|
||||
// This guards against the Cast SDK triggering a local-network permission
|
||||
|
|
@ -87,7 +92,13 @@
|
|||
// Skip on initial launch — only run on true background resumes.
|
||||
static BOOL _gestureResetSkipFirstActivation = YES;
|
||||
- (void)applicationDidBecomeActive:(UIApplication *)application {
|
||||
[super applicationDidBecomeActive:application];
|
||||
// RCTAppDelegate (UIResponder) n'implémente PAS applicationDidBecomeActive:.
|
||||
// Cette méthode est appelée à CHAQUE lancement : un [super ...] aveugle
|
||||
// crashait l'app au démarrage (unrecognized selector). On garde l'appel
|
||||
// conditionnel pour rester compatible si une future version de RN l'ajoute.
|
||||
if ([[self superclass] instancesRespondToSelector:_cmd]) {
|
||||
[super applicationDidBecomeActive:application];
|
||||
}
|
||||
|
||||
if (_gestureResetSkipFirstActivation) {
|
||||
_gestureResetSkipFirstActivation = NO;
|
||||
|
|
|
|||
Loading…
Reference in a new issue