Ios sim 9.0/10.0 :: ERROR: Error: A network error occurred


#1

Hey guys,

Im having this error, it started suddenly i cant figure out why.


Ionic 1.3.2 (also tried 1.3.1)
Cordova-ios 4.1.0
Plugins
com.bez4pieci.cookies 0.0.1 "Cookies"
cordova-plugin-app-version 0.1.8 "AppVersion"
cordova-plugin-compat 1.0.0 "Compat"
cordova-plugin-console 1.0.4 "Console"
cordova-plugin-datepicker 0.9.2 "DatePicker"
cordova-plugin-device 1.1.3 "Device"
cordova-plugin-file 4.3.0 "File"
cordova-plugin-google-analytics 1.6.0 "Google Universal Analytics Plugin"
cordova-plugin-inappbrowser 1.5.0 "InAppBrowser"
cordova-plugin-splashscreen 4.0.0 "Splashscreen"
cordova-plugin-statusbar 2.2.0 "StatusBar"
cordova-plugin-whitelist 1.3.0 "Whitelist"
cordova-plugin-wkwebview-engine 1.1.0 "Cordova WKWebView Engine"
cordova-sqlite-storage 1.4.5 "Cordova sqlite storage plugin"
ionic-plugin-keyboard 2.2.1 "Keyboard"
phonegap-plugin-barcodescanner 6.0.3 "BarcodeScanner"
phonegap-plugin-push 1.8.3 “PushPlugin”


2016-11-14 11:37:07.712 2taps[3532:108894] ERROR: Error: A network error occurred.
send@[native code]
file:///Users/davixz/Library/Developer/CoreSimulator/Devices/56DCE6B0-646D-4C6D-977D-D0E5DFE31B1C/data/Containers/Bundle/Application/90D04154-9C78-49DB-978D-D9AA645F808B/2taps.app/www/lib/ionic/js/ionic.bundle.js:25005:15
sendReq@file:///Users/davixz/Library/Developer/CoreSimulator/Devices/56DCE6B0-646D-4C6D-977D-D0E5DFE31B1C/data/Containers/Bundle/Application/90D04154-9C78-49DB-978D-D9AA645F808B/2taps.app/www/lib/ionic/js/ionic.bundle.js:24798:21
serverRequest@file:///Users/davixz/Library/Developer/CoreSimulator/Devices/56DCE6B0-646D-4C6D-977D-D0E5DFE31B1C/data/Containers/Bundle/Application/90D04154-9C78-49DB-978D-D9AA645F808B/2taps.app/www/lib/ionic/js/ionic.bundle.js:24508:23
processQueue@file:///Users/davixz/Library/Developer/CoreSimulator/Devices/56DCE6B0-646D-4C6D-977D-D0E5DFE31B1C/data/Containers/Bundle/Application/90D04154-9C78-49DB-978D-D9AA645F808B/2taps.app/www/lib/ionic/js/ionic.bundle.js:29132:30
file:///Users/davixz/Library/Developer/CoreSimulator/Devices/56DCE6B0-646D-4C6D-977D-D0E5DFE31B1C/data/Containers/Bundle/Application/90D04154-9C78-49DB-978D-D9AA645F808B/2taps.app/www/lib/ionic/js/ionic.bundle.js:29148:39
$digest@file:///Users/davixz/Library/Developer/CoreSimulator/Devices/56DCE6B0-646D-4C6D-977D-D0E5DFE31B1C/data/Containers/Bundle/Application/90D04154-9C78-49DB-978D-D9AA645F808B/2taps.app/www/lib/ionic/js/ionic.bundle.js:30216:36
$apply@file:///Users/davixz/Library/Developer/CoreSimulator/Devices/56DCE6B0-646D-4C6D-977D-D0E5DFE31B1C/data/Containers/Bundle/Application/90D04154-9C78-49DB-978D-D9AA645F808B/2taps.app/www/lib/ionic/js/ionic.bundle.js:30508:31
bootstrapApply@file:///Users/davixz/Library/Developer/CoreSimulator/Devices/56DCE6B0-646D-4C6D-977D-D0E5DFE31B1C/data/Containers/Bundle/Application/90D04154-9C78-49DB-978D-D9AA645F808B/2taps.app/www/lib/ionic/js/ionic.bundle.js:15088:21
doBootstrap@file:///Users/davixz/Library/Developer/CoreSimulator/Devices/56DCE6B0-646D-4C6D-977D-D0E5DFE31B1C/data/Containers/Bundle/Application/90D04154-9C78-49DB-978D-D9AA645F808B/2taps.app/www/lib/ionic/js/ionic.bundle.js:15086:20
angularInit@file:///Users/davixz/Library/Developer/CoreSimulator/Devices/56DCE6B0-646D-4C6D-977D-D0E5DFE31B1C/data/Containers/Bundle/Application/90D04154-9C78-49DB-978D-D9AA645F808B/2taps.app/www/lib/ionic/js/ionic.bundle.js:14991:14
file:///Users/davixz/Library/Developer/CoreSimulator/Devices/56DCE6B0-646D-4C6D-977D-D0E5DFE31B1C/data/Containers/Bundle/Application/90D04154-9C78-49DB-978D-D9AA645F808B/2taps.app/www/lib/ionic/js/ionic.bundle.js:44084:16
trigger@file:///Users/davixz/Library/Developer/CoreSimulator/Devices/56DCE6B0-646D-4C6D-977D-D0E5DFE31B1C/data/Containers/Bundle/Application/90D04154-9C78-49DB-978D-D9AA645F808B/2taps.app/www/lib/ionic/js/ionic.bundle.js:16502:9
defaultHandlerWrapper@file:///Users/davixz/Library/Developer/CoreSimulator/Devices/56DCE6B0-646D-4C6D-977D-D0E5DFE31B1C/data/Containers/Bundle/Application/90D04154-9C78-49DB-978D-D9AA645F808B/2taps.app/www/lib/ionic/js/ionic.bundle.js:16792:15
eventHandler@file:///Users/davixz/Library/Developer/CoreSimulator/Devices/56DCE6B0-646D-4C6D-977D-D0E5DFE31B1C/data/Containers/Bundle/Application/90D04154-9C78-49DB-978D-D9AA645F808B/2taps.app/www/lib/ionic/js/ionic.bundle.js:16780:23



#2

Hey guys

Although i dont know why this started to happening, i was able to solve it by using bellow content security policy meta tag in index.html:
More specifically the “gap:” in the default-src property that looks like is needed to the cordova on device ready event.

DONT COPY AND PASTE THIS META TAG BELLOW
This is the CSP meta tag of my app. You should read the documentation of the CSP metatag and formulate your own


#3

hi i already have the gap://ready in my meta tag for content-security-policy, do you know if anything else could help solve this problem


#4

Try this inside the content="" property of the meta tag just to see if the error disapear

      default-src
        'self'
        data:
        gap:
        file:
      ;
      img-src *
      ;
      style-src
        'self'
        'unsafe-inline'
      ;
      script-src
        'self'
        'unsafe-eval'
      ;