From ca65a403e28a9cb8246cca925986feffd94c62e7 Mon Sep 17 00:00:00 2001 From: kr-yeon <65217664+kr-yeon@users.noreply.github.com> Date: Tue, 27 Jun 2023 16:41:10 +0900 Subject: [PATCH] Update RNExitApp.mm Apps that look like errors may be rejected by Apple. So I corrected it. --- ios/RNExitApp/RNExitApp.mm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ios/RNExitApp/RNExitApp.mm b/ios/RNExitApp/RNExitApp.mm index 4c9bcd4..5156ce4 100644 --- a/ios/RNExitApp/RNExitApp.mm +++ b/ios/RNExitApp/RNExitApp.mm @@ -12,7 +12,13 @@ @implementation RNExitApp RCT_EXPORT_METHOD(exitApp) { - exit(0); + dispatch_async(dispatch_get_main_queue(), ^{ + [[UIApplication sharedApplication] performSelector:@selector(suspend)]; + + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + exit(0); + }); + }); }; # pragma mark - New Architecture