Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSURLConnection error 1100 while running ionic app on iOS

I have build an app with ionic 4 and cordova. On android the app runs like a charm but on iOS I just get some strange problems... like others do (Ionic IOS app NSURLConnection error 1100, ionic 4 app shows white screen on ios with error code 1100). The app ionic build runs fine without any errors and just a few warnings of unused imports. Also the xcode build is fast and successfull. But when the app is running on a real device or simulator, I just get a blank white screen. In the console I get this with addional debugging:

I found like mentioned some similar issues and also added the environment variable (CFNETWORK_DIAGNOSTICS = 1) for advanced network logging to get more infos in the console (whole file: https://pastebin.com/yecJ5Vzy) or some snippets here:

2019-05-03 10:59:49.788736+0200 MyNiceApp[3426:1312031] CFNetwork Diagnostics [1:1] 10:59:49.787 {
DiskCookieStorage Construction: Binary{ Disk Cookies: { /private/var/mobile/Containers/Data/Application/23CCB045-0976-4DD0-A19B-0BD8CB6825FD/Library/Cookies/Cookies.binarycookies, <0 cookies in 0 domains> clean not writing } }
                     Accessing: <CFURL 0x282db3c60 [0x1bda5d610]>{string = file:///private/var/mobile/Containers/Data/Application/13371337-0976-4DD0-A19B-0BD8CXYZAS/Library/Cookies/Cookies.binarycookies, encoding = 13371337, base = (null)}
                          Path: /private/var/mobile/Containers/Data/Application/13371337-0976-4DD0-A19B-0BD8CXYZAS/Library/Cookies/Cookies.binarycookies
                Read from disk: <0 cookies in 0 domains>
                         Dirty: NO
                       Writing: NO
                        Policy: 0
} [1:1]
2019-05-03 10:59:49.788845+0200 MyNiceApp[3426:1312031] CFNetwork Diagnostics [1:2] 10:59:49.788 {
DiskCookieStorage Journaling On: Binary{ Disk Cookies: { /private/var/mobile/Containers/Data/Application/13371337-0976-4DD0-A19B-0BD8CXYZAS/Library/Cookies/Cookies.binarycookies, <0 cookies in 0 domains> clean not writing } }
                           File: <CFURL 0x282db3c60 [0x1bda5d610]>{string = file:///private/var/mobile/Containers/Data/Application/13371337-0976-4DD0-A19B-0BD8CXYZAS/Library/Cookies/Cookies.binarycookies, encoding = 13371337, base = (null)}
} [1:2]
2019-05-03 10:59:49.879254+0200 MyNiceApp[3426:1312031] Apache Cordova native platform version 5.0.0 is starting.
2019-05-03 10:59:49.879772+0200 MyNiceApp[3426:1312031] Multi-tasking -> Device: YES, App: YES
2019-05-03 10:59:49.901704+0200 MyNiceApp[3426:1312031] Using UIWebView
2019-05-03 10:59:49.904145+0200 MyNiceApp[3426:1312031] [CDVTimer][console] 0.041008ms
2019-05-03 10:59:49.904228+0200 MyNiceApp[3426:1312031] [CDVTimer][handleopenurl] 0.049949ms
2019-05-03 10:59:49.905236+0200 MyNiceApp[3426:1312031] Unlimited access to network resources
2019-05-03 10:59:49.905271+0200 MyNiceApp[3426:1312031] [CDVTimer][intentandnavigationfilter] 1.001954ms
2019-05-03 10:59:49.905338+0200 MyNiceApp[3426:1312031] [CDVTimer][gesturehandler] 0.050068ms
2019-05-03 10:59:49.905379+0200 MyNiceApp[3426:1312031] [CDVTimer][backgroundfetch] 0.025034ms
2019-05-03 10:59:49.905397+0200 MyNiceApp[3426:1312031] [CDVTimer][TotalPluginStartup] 1.327991ms
2019-05-03 10:59:50.139954+0200 MyNiceApp[3426:1312031] Resetting plugins due to page load.
2019-05-03 10:59:50.158278+0200 MyNiceApp[3426:1312115] CFNetwork Diagnostics [1:3] 10:59:50.158 {
LoaderWhatToDo: (null)
       Request: <CFURL 0x282db7c00 [0x1bda5d610]>{string = file:///var/containers/Bundle/Application/13371337-0976-4DD0-A19B-0BD8CXYZAS/MyNiceApp.app/www/index.html, encoding = 13371337, base = (null)}
   CachePolicy: 0
      WhatToDo: originload
   CreateToNow: 0.00069s
} [1:3]
2019-05-03 10:59:50.161705+0200 MyNiceApp[3426:1312031] Failed to load webpage with error: The operation couldn’t be completed. (NSURLErrorDomain error -999.)
2019-05-03 10:59:50.162212+0200 MyNiceApp[3426:1312031] Resetting plugins due to page load.
2019-05-03 10:59:50.162894+0200 MyNiceApp[3426:1312115] CFNetwork Diagnostics [1:4] 10:59:50.162 {
LoaderWhatToDo: (null)
       Request: <CFURL 0x282d94060 [0x1bda5d610]>{string = file:///var/containers/Bundle/Application/13371337-0976-4DD0-A19B-0BD8CXYZAS/MyNiceApp.app/www/index.html, encoding = 13371337, base = (null)}
   CachePolicy: 0
      WhatToDo: originload
   CreateToNow: 0.00030s
} [1:4]

And a bit later in the console log:

2019-05-03 10:59:50.278000+0200 MyNiceApp[3426:1312114] NSURLConnection finished with error - code -1100
2019-05-03 10:59:50.278024+0200 MyNiceApp[3426:1312114] NSURLConnection finished with error - code -1100

It seems like the app can't load its own files.. since the error -1100 means NSURLErrorFileDoesNotExist

like image 899
white91wolf Avatar asked May 03 '19 10:05

white91wolf


2 Answers

Had the same issue and after quite a bit struggle and R&D this is what worked for me.

Seems like relative path is taken by IOS so in your src -> index.html please change this base href="/" to base href="./" (note dot at the beginning of the /)

this will load all the relevant js files (cordova.js, polyfill.js etc.)

the 1100 errors are files not being found due to absolute path.

like image 175
Balaji Avatar answered Nov 15 '22 12:11

Balaji


After researching a lot a trying a lot of stuff, my solution was to execute this command:

ionic cordova plugin add cordova-plugin-ionic-webview --save

like image 1
raulchopi Avatar answered Nov 15 '22 12:11

raulchopi