iOS cordova应用程序在启动屏幕后挂起

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了iOS cordova应用程序在启动屏幕后挂起相关的知识,希望对你有一定的参考价值。

我正在编译我的应用程序的新版本,并且在设备和模拟器上的启动屏幕均显示为空白后。我构建的应用程序的最新版本运行良好……当前版本可以在android设备上正常运行。以下日志与应用程序启动时没有问题的情况几乎相同,因此我不知道是什么原因导致了此WOD。我该如何解决?我还能如何获得有关屏幕为何挂起的真实日志?

在Safari Inspector中,我可以看到整个应用程序html的加载情况都很好……似乎所有内容都在那里。同样,控制台日志中报告的JS / AngularJS错误为零。

我添加了一些console.logs,以查看是否可以确定至少要到达的位置,但甚至不能确定它们是如何在Xcode或Safari检查器中打印到控制台的。

这是我的环境:

离子信息

Ionic:

   Ionic CLI         : 5.4.4 (/usr/local/lib/node_modules/ionic)
   Ionic Framework   : ionic1 1.0.0
   @ionic/v1-toolkit : 1.0.22

Cordova:

   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : ios 5.0.1
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.1.3, (and 32 other plugins)

Utility:

   cordova-res : 0.6.0 (update available: 0.9.0)
   native-run  : 0.2.8 (update available: 0.3.0)

System:

   ios-deploy : 1.9.4
   ios-sim    : 8.0.2
   NodeJS     : v10.16.3 (/usr/local/bin/node)
   npm        : 6.11.2
   OS         : macOS High Sierra
   Xcode      : Xcode 10.1 Build version 10B61

并且控制台日志,我认为以下任何错误/警告都不会导致应用程序挂起或进入白屏-我之前已经看过所有这些内容,但都没有影响到应用程序。我进行的大多数研究都似乎是良性的。

2020-02-24 16:33:28.729280-0500 myApp[14811:15566848] Apache Cordova native platform version 5.0.1 is starting.
2020-02-24 16:33:28.729542-0500 myApp[14811:15566848] Multi-tasking -> Device: YES, App: YES
2020-02-24 16:33:28.790743-0500 myApp[14811:15566848] Using UIWebView
2020-02-24 16:33:28.793978-0500 myApp[14811:15566848] [CDVTimer][console] 0.138044ms
2020-02-24 16:33:28.794282-0500 myApp[14811:15566848] [CDVTimer][handleopenurl] 0.170946ms
2020-02-24 16:33:28.797984-0500 myApp[14811:15566848] Unlimited access to network resources
2020-02-24 16:33:28.798184-0500 myApp[14811:15566848] [CDVTimer][intentandnavigationfilter] 3.751993ms
2020-02-24 16:33:28.798528-0500 myApp[14811:15566848] [CDVTimer][gesturehandler] 0.252962ms
2020-02-24 16:33:28.799284-0500 myApp[14811:15566848] [CDVTimer][admob] 0.651956ms
2020-02-24 16:33:28.799605-0500 myApp[14811:15566848] Starting Facebook Connect plugin
2020-02-24 16:33:28.799703-0500 myApp[14811:15566848] [CDVTimer][facebookconnectplugin] 0.335932ms
2020-02-24 16:33:28.803213-0500 myApp[14811:15566848] [CDVTimer][file] 3.353000ms
2020-02-24 16:33:28.803581-0500 myApp[14811:15566848] Starting Firebase plugin
2020-02-24 16:33:28.810921-0500 myApp[14811:15566848] [CDVTimer][firebaseplugin] 7.617950ms
2020-02-24 16:33:28.811294-0500 myApp[14811:15566848] [CDVTimer][inappbrowser] 0.249028ms
2020-02-24 16:33:28.811595-0500 myApp[14811:15566848] [CDVTimer][uiinappbrowser] 0.189900ms
2020-02-24 16:33:28.811863-0500 myApp[14811:15566848] [CDVTimer][wkinappbrowser] 0.159979ms
2020-02-24 16:33:28.812128-0500 myApp[14811:15566848] CDVIonicKeyboard: resize mode 1
2020-02-24 16:33:28.814081-0500 myApp[14811:15566848] CDVIonicKeyboard: WARNING!!: Keyboard plugin works better with WK
2020-02-24 16:33:28.814370-0500 myApp[14811:15566848] [CDVTimer][keyboard] 2.269983ms
2020-02-24 16:33:28.821986-0500 myApp[14811:15567042] registerForRemoteNotifications
2020-02-24 16:33:28.830875-0500 myApp[14811:15566848] [CDVTimer][splashscreen] 16.288996ms
2020-02-24 16:33:28.842044-0500 myApp[14811:15566848] [CDVTimer][statusbar] 11.017084ms
2020-02-24 16:33:28.842496-0500 myApp[14811:15566848] [CDVTimer][diagnostic] 0.326037ms
2020-02-24 16:33:28.844525-0500 myApp[14811:15566848] [CDVTimer][diagnostic_location] 1.947999ms
2020-02-24 16:33:28.844721-0500 myApp[14811:15566848] [CDVTimer][diagnostic_notifications] 0.103951ms
2020-02-24 16:33:28.844770-0500 myApp[14811:15566848] [CDVTimer][TotalPluginStartup] 51.038027ms
2020-02-24 16:33:28.857988-0500 myApp[14811:15566848] GoogleService-Info.plist found, setup: [FIRApp configureWithOptions]
2020-02-24 16:33:28.889418-0500 myApp[14811:15566848] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2020-02-24 16:33:28.890284-0500 myApp[14811:15566848] [MC] Reading from public effective user settings.
2020-02-24 16:33:28.961518-0500 myApp[14811:15567038] [NetworkInfo] Signal strength query returned error: Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied", descriptor: <CTServiceDescriptor 0x280e2fda0, domain=1, instance=1>
2020-02-24 16:33:29.071782-0500 myApp[14811:15567057] Metal GPU Frame Capture Enabled
2020-02-24 16:33:29.079541-0500 myApp[14811:15567057] Metal API Validation Enabled
2020-02-24 16:33:29.249063-0500 myApp[14811:15567059] 6.3.0 - [Firebase/Messaging][I-FCM001000] FIRMessaging Remote Notifications proxy enabled, will swizzle remote notification receiver handlers. If you'd prefer to manually integrate Firebase Messaging, add "FirebaseAppDelegateProxyEnabled" to your Info.plist, and set it to NO. Follow the instructions at:
https://firebase.google.com/docs/cloud-messaging/ios/client#method_swizzling_in_firebase_messaging
to ensure proper integration.
2020-02-24 16:33:29.251884-0500 myApp[14811:15567059] 6.3.0 - [Firebase/Analytics][I-ACS025028] AdMob and Firebase are in use in this app, but are not linked. For analytics data consistency and integrity, it is highly recommended that you link your AdMob app to the corresponding Firebase app and re-download the GoogleServices-Info.plist file. See https://support.google.com/admob/answer/6383165 for more information.
2020-02-24 16:33:29.255383-0500 myApp[14811:15567059] 6.3.0 - [Firebase/Analytics][I-ACS023007] Analytics v.60002000 started
2020-02-24 16:33:29.255771-0500 myApp[14811:15567059] 6.3.0 - [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled
2020-02-24 16:33:29.270990-0500 myApp[14811:15567042] _hasPermission: YES
2020-02-24 16:33:29.283845-0500 myApp[14811:15566848] didReceiveRegistrationToken: fOrgQHaXCTQ:APA91bFfK-xz7DpwU8AvnoXQybZY6xDawTkVwj6GtJGCbRDRz9E7IIyEvf0wycPIWffthW1J1p8JmafLu32WGWhvCJ8aoUT_cKMNERQ6fQ_7xjL-veEK5F7sPMc7BUEjee3cEbkKThSY
2020-02-24 16:33:29.293043-0500 myApp[14811:15566848] FCM direct channel = true
2020-02-24 16:33:29.303036-0500 myApp[14811:15566848] FB Hybrid app events cannot be enabled, this feature requires WKWebView
2020-02-24 16:33:29.309203-0500 myApp[14811:15567057] [NetworkInfo] Signal strength query returned error: Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied", descriptor: <CTServiceDescriptor 0x280e3b9c0, domain=1, instance=1>
2020-02-24 16:33:29.392367-0500 myApp[14811:15567038] 6.3.0 - [Firebase/Analytics][I-ACS025026] Deferring to Firebase for event data collection
2020-02-24 16:33:29.403092-0500 myApp[14811:15566848] didRegisterForRemoteNotificationsWithDeviceToken: <70ad34cb 9dac7233 966cd8b7 d1612273 03bad35a f08c430a bf1ed4c7 a257bac9>
2020-02-24 16:33:29.433757-0500 myApp[14811:15566848] Resetting plugins due to page load.
2020-02-24 16:33:29.434371-0500 myApp[14811:15566848] IAB.close() called but it was already closed.
2020-02-24 16:33:29.434464-0500 myApp[14811:15566848] IAB.close() called but it was already closed.
2020-02-24 16:33:29.457026-0500 myApp[14811:15566848] Failed to load webpage with error: The operation couldn’t be completed. (NSURLErrorDomain error -999.)
2020-02-24 16:33:29.470218-0500 myApp[14811:15566848] Resetting plugins due to page load.
2020-02-24 16:33:29.470385-0500 myApp[14811:15566848] IAB.close() called but it was already closed.
2020-02-24 16:33:29.470421-0500 myApp[14811:15566848] IAB.close() called but it was already closed.
2020-02-24 16:33:29.507982-0500 myApp[14811:15567061] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C1.1:2][0x102936400] get output frames failed, state 8196
2020-02-24 16:33:29.508234-0500 myApp[14811:15567061] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C1.1:2][0x102936400] get output frames failed, state 8196
2020-02-24 16:33:29.508700-0500 myApp[14811:15567061] TIC Read Status [1:0x0]: 1:57
2020-02-24 16:33:29.508743-0500 myApp[14811:15567061] TIC Read Status [1:0x0]: 1:57
2020-02-24 16:33:29.701653-0500 myApp[14811:15566848] [NetworkInfo] Signal strength query returned error: Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied", descriptor: <CTServiceDescriptor 0x280e572c0, domain=1, instance=1>
2020-02-24 16:33:29.713627-0500 myApp[14811:15567056] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C2.1:2][0x1028093c0] get output frames failed, state 8196
2020-02-24 16:33:29.717303-0500 myApp[14811:15567056] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C2.1:2][0x1028093c0] get output frames failed, state 8196
2020-02-24 16:33:29.718170-0500 myApp[14811:15567056] TIC Read Status [2:0x0]: 1:57
2020-02-24 16:33:29.718216-0500 myApp[14811:15567056] TIC Read Status [2:0x0]: 1:57
2020-02-24 16:33:29.719928-0500 myApp[14811:15567056] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C3.1:2][0x1028270e0] get output frames failed, state 8196
2020-02-24 16:33:29.720165-0500 myApp[14811:15567056] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C3.1:2][0x1028270e0] get output frames failed, state 8196
2020-02-24 16:33:29.720718-0500 myApp[14811:15567056] TIC Read Status [3:0x0]: 1:57
2020-02-24 16:33:29.720805-0500 myApp[14811:15567056] TIC Read Status [3:0x0]: 1:57
2020-02-24 16:33:29.787548-0500 myApp[14811:15567056] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C5.1:2][0x102832530] get output frames failed, state 8196
2020-02-24 16:33:29.788231-0500 myApp[14811:15567056] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C5.1:2][0x102832530] get output frames failed, state 8196
2020-02-24 16:33:29.788608-0500 myApp[14811:15567056] TIC Read Status [5:0x0]: 1:57
2020-02-24 16:33:29.788642-0500 myApp[14811:15567056] TIC Read Status [5:0x0]: 1:57
2020-02-24 16:33:29.914614-0500 myApp[14811:15567109] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C6.1:2][0x102833ed0] get output frames failed, state 8196
2020-02-24 16:33:29.914982-0500 myApp[14811:15567109] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C6.1:2][0x102833ed0] get output frames failed, state 8196
2020-02-24 16:33:29.918861-0500 myApp[14811:15567109] TIC Read Status [6:0x0]: 1:57
2020-02-24 16:33:29.918976-0500 myApp[14811:15567109] TIC Read Status [6:0x0]: 1:57
2020-02-24 16:33:30.569146-0500 myApp[14811:15566848] Finished load of: file:///var/containers/Bundle/Application/1613C55A-6D2F-4B41-A73F-A24DB76501E4/myApp.app/www/index.html
答案

[我以前在Cordova(使用ExtJS框架,而不是Ionic编写)的应用程序中遇到类似的问题,该应用程序会在启动屏幕后挂起,主要是在iOS上。

问题

Cordova可以很好地加载,但是框架不是。 (原因不明)因此,已加载index.html并触发了deviceready事件,但是该框架为空且无法启动。

解决方法

我从没有找到问题的根源(并且我怀疑它与您的问题无关),但是由于触发了deviceready,因此我在运行时检查框架是否已加载,如果没有加载,则重新加载整个应用程序。对于用户而言,启动屏幕仅出现一次,然后淡出,屏幕保持白色(当应用程序在后台重新加载时),并且该应用程序出现。

在我的index.html中,类似的内容

function onDeviceReady() 
    //...

    try 
        var isFrameworkLoaded = ....

        if (isFrameworkLoaded !== true) 
            console.log("onDeviceReady() : FORCE RELOAD");
            location.reload();  // Reloads the index.html page, and doesn't reload the splashscreen
            return;
        
     catch (e) 
        console.warn("onDeviceReady : Error : " + e);
    

以上是关于iOS cordova应用程序在启动屏幕后挂起的主要内容,如果未能解决你的问题,请参考以下文章

使用 React 和 Socket.io 的聊天应用程序在发送太多消息后挂起

MFC 应用程序在 CSingleLock Lock() 后挂起

启动特定子进程后挂起进程

ASP.NET 应用程序在调用后挂起

地理定位在 x 次尝试后挂起,在浏览器重新启动后工作

Cordova iOS 应用程序在启动故事板和第一个屏幕之间出现白色闪光