Deviceready only fire after 30 seconds in iOS 10

I deviceready doesn't work or doesn't work very late in my ionic app when I launch it on my iOS device using

ionic run ios --device -lcs 

I removed all the plugins using the ionic plugin rm ... , deleted the contents of the plugins/ directory and reinstalled them. I also uninstalled and reinstalled the ios platform using the ionic platform rm/add ios .

I am stuck in this.

iPhone (6+) is on iOS 10.

I use ion 1 and the last ion CLI.

EDIT: I removed all the plugins one by one, and it seems that the problem is with the cord plugin network information and the cord plugin device.

Any idea?

thanks

 Process 663 detached (lldb) (node:26790) DeprecationWarning: Using Buffer without `new` will soon stop working. Use `new Buffer()`, or preferably `Buffer.from()`, `Buffer.allocUnsafe()` or `Buffer.alloc()` instead. 14 030280 warn Native: deviceready did not fire within 2000ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them. 15 030605 info [object Object] 16 033286 log deviceready has not fired after 5 seconds. 17 033290 log Channel not fired: onCordovaInfoReady 18 033293 log Channel not fired: onCordovaConnectionReady 19 363977 log DEVICE READY FIRED AFTER, 32259, ms 

My run.js, AppCtrl.js and my main view controller are encapsulated in $ ionicPlatform.ready (function () {..}); `

My content security policy:

 <meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; script-src 'self' 'unsafe-inline' 'unsafe-eval' *; connect-src 'self' 'unsafe-inline' 'unsafe-eval' blob: ws: *;"> 
+6
source share
2 answers

I added Thank you for your answer @baviskarmitesh. But I had to add gap to the content security policy, and now it works.

I added data: gap: https://ssl.gstatic.com 'unsafe-eval' after default-src * to my content security policy in my index.html file, for example:

 <meta http-equiv="Content-Security-Policy" content=" default-src * data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; script-src 'self' 'unsafe-inline' 'unsafe-eval' *; connect-src 'self' 'unsafe-inline' 'unsafe-eval' blob: ws: *; "> 

And now deviceready works quickly with all my plugins.

+10
source

This is apparently a common problem with the Ionic framework, and there may be several reasons for this. One of the reasons may be some problem with the plugin that you are using, as well as some problem in the platform folder. There seems to be an open problem in this issue in the Ionic CLI project.

The following are possible fixes for this problem:

  • Removing damaged plugins and re-adding the same ones
  • Deleting a folder with the platform and re-adding it.
  • Probably don't use the live reboot option
  • If the problem is related to iOS, then you can try to soften the content security policy.

You can also see the link

Hope this helps.

+1
source

Source: https://habr.com/ru/post/1012841/


All Articles