我开发了 ionic 应用程序,它在 android 和浏览器上运行得很好,现在我在 ios 上运行。当我在模拟器上运行应用程序时,应用程序启动并不断显示第一个( ionic 符号页面),并保持原样。
我检查了日志,
我发现错误 Internal navigation rejected: <allow-navigation not set>
如本 question 中所回答我关注了<allow-navigation href="*" />
但在下一次运行中我得到了新的错误,
navigation rejected - <allow-navigation> not set for url='gap://ready'
谁能告诉我它到底是什么gap://ready
我的 logcat 作为,
2018-02-15 08:53:26.667295-0500 MyApp[25051:947093] DiskCookieStorage changing policy from 2 to 0, cookie file: file:///Users/madhur/Library/Developer/CoreSimulator/Devices/10AB7D02-82BE-48D5-9F7A-8E32C7522FD1/data/Containers/Data/Application/5988B7DB-8F18-4213-B611-F6C2E076577F/Library/Cookies/com.cmsbiyani.binarycookies
2018-02-15 08:53:26.967945-0500 MyApp[25051:947093] Apache Cordova native platform version 4.5.3 is starting.
2018-02-15 08:53:26.969058-0500 MyApp[25051:947093] Multi-tasking -> Device: YES, App: YES
2018-02-15 08:53:27.016616-0500 MyApp[25051:947093] CDVWKWebViewEngine: trying to inject XHR polyfill
2018-02-15 08:53:27.313401-0500 MyApp[25051:947093] [MC] Lazy loading NSBundle MobileCoreServices.framework
2018-02-15 08:53:27.324135-0500 MyApp[25051:947093] [MC] Loaded MobileCoreServices.framework
2018-02-15 08:53:30.288878-0500 MyApp[25051:947093] CDVWKWebViewEngine will reload WKWebView if required on resume
2018-02-15 08:53:30.289800-0500 MyApp[25051:947093] Using Ionic WKWebView
2018-02-15 08:53:30.292733-0500 MyApp[25051:947093] [CDVTimer][console] 0.328064ms
2018-02-15 08:53:30.294557-0500 MyApp[25051:947093] [CDVTimer][handleopenurl] 0.702024ms
2018-02-15 08:53:30.302675-0500 MyApp[25051:947093] [CDVTimer][intentandnavigationfilter] 7.043958ms
2018-02-15 08:53:30.303247-0500 MyApp[25051:947093] [CDVTimer][gesturehandler] 0.195026ms
2018-02-15 08:53:30.398290-0500 MyApp[25051:947093] [CDVTimer][splashscreen] 94.652057ms
2018-02-15 08:53:30.398900-0500 MyApp[25051:947093] [CDVTimer][uniquedeviceid] 0.187039ms
2018-02-15 08:53:30.404529-0500 MyApp[25051:947093] [CDVTimer][keyboard] 5.079985ms
2018-02-15 08:53:30.405271-0500 MyApp[25051:947093] [CDVTimer][TotalPluginStartup] 112.934947ms
2018-02-15 08:53:30.439021-0500 MyApp[25051:947093] DidFinishLaunchingWithOptions
2018-02-15 08:53:30.678659-0500 MyApp[25051:947337] 4.9.0 - [Firebase/Analytics][I-ACS023007] Firebase Analytics v.40009000 started
2018-02-15 08:53:30.682557-0500 MyApp[25051:947337] 4.9.0 - [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled
2018-02-15 08:53:30.887251-0500 MyApp[25051:947391] 4.9.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.
2018-02-15 08:53:30.889898-0500 MyApp[25051:947093] createNotificationChecker
2018-02-15 08:53:30.890256-0500 MyApp[25051:947093] not coldstart
2018-02-15 08:53:31.083992-0500 MyApp[25051:947093] Unexpected call to didFailToRegisterForRemoteNotificationsWithError, ignoring: Error Domain=NSCocoaErrorDomain Code=3010 "remote notifications are not supported in the simulator" UserInfo={NSLocalizedDescription=remote notifications are not supported in the simulator}
2018-02-15 08:53:31.112584-0500 MyApp[25051:947093] app become active
2018-02-15 08:53:31.142949-0500 MyApp[25051:947093] active
2018-02-15 08:53:31.148885-0500 MyApp[25051:947093] PushPlugin skip clear badge
2018-02-15 08:53:31.546226-0500 MyApp[25051:947389] TIC Read Status [1:0x0]: 1:57
2018-02-15 08:53:31.546449-0500 MyApp[25051:947389] TIC Read Status [1:0x0]: 1:57
2018-02-15 08:53:32.087448-0500 MyApp[25051:947337] 4.9.0 - [Firebase/Messaging][I-FCM012002] Error in application:didFailToRegisterForRemoteNotificationsWithError: remote notifications are not supported in the simulator
2018-02-15 08:53:33.802288-0500 MyApp[25051:947093] app become active
2018-02-15 08:53:33.803760-0500 MyApp[25051:947093] active
2018-02-15 08:53:33.804472-0500 MyApp[25051:947093] PushPlugin skip clear badge
2018-02-15 08:53:34.106383-0500 MyApp[25051:947093] InstanceID token: eMNbF4IglXM:APA91bGDe2LC_9L3GBc-gSbbCuoTAc2U7TNwcZbRRkQXEQ5gIlAho2eh33Ga4YUobzxfodvPubzE2oU1g75fwoPlgBGCmAAhh_M8_4F6fU2CZE7LSYcznM8gs_uuyu8QPUUyK65MqB3c
2018-02-15 08:53:34.308040-0500 MyApp[25051:947093] Connected to FCM.
2018-02-15 08:53:45.704630-0500 MyApp[25051:947093] ERROR Internal navigation rejected - <allow-navigation> not set for url='gap://ready'
2018-02-15 08:53:45.791635-0500 MyApp[25051:947093] FCMPlugin.js: is created
2018-02-15 08:53:45.798957-0500 MyApp[25051:947093] Ionic Native: deviceready event fired after 3094 ms
2018-02-15 08:53:45.799765-0500 MyApp[25051:947093] Cordova view ready
2018-02-15 08:53:45.806069-0500 MyApp[25051:947093] FCMPlugin Ready OK
2018-02-15 08:53:46.754941-0500 MyApp[25051:947834] TIC Read Status [6:0x0]: 1:57
2018-02-15 08:53:46.755146-0500 MyApp[25051:947834] TIC Read Status [6:0x0]: 1:57
2018-02-15 08:53:46.984248-0500 MyApp[25051:947834] TIC Read Status [7:0x0]: 1:57
2018-02-15 08:53:46.984512-0500 MyApp[25051:947834] TIC Read Status [7:0x0]: 1:57
2018-02-15 08:57:31.269002-0500 MyApp[25051:956884] TIC Read Status [2:0x0]: 1:57
2018-02-15 08:57:31.269657-0500 MyApp[25051:956884] TIC Read Status [2:0x0]: 1:57
2018-02-15 08:57:33.794992-0500 MyApp[25051:957714] TIC Read Status [3:0x0]: 1:57
2018-02-15 08:57:33.795472-0500 MyApp[25051:957714] TIC Read Status [3:0x0]: 1:57
2018-02-15 08:57:34.947096-0500 MyApp[25051:957819] TIC Read Status [5:0x0]: 1:57
2018-02-15 08:57:34.947301-0500 MyApp[25051:957819] TIC Read Status [5:0x0]: 1:57
最佳答案
'gap' 在 iOS 上使用 UIWebView 时是必需的,也是 js/ native 通信所必需的。 此标记必须添加到 index.html 上,覆盖元标记 content-security-policy。
您可以在https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-whitelist/#content-security-policy 上双击此信息。和 https://content-security-policy.com/和 https://developer.apple.com/documentation/uikit/uiwebview/1617943-gapbetweenpages , https://developer.apple.com/documentation/uikit/uiwebview
关于ios - 导航被拒绝 - <allow-navigation> 没有为 url ='gap://ready' 设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48809260/