Discussion Forums  >  Xcode, Errors, Installing, Configuring

Replies: 17    Views: 1139

DougJoseph
Aspiring developer
Profile
Posts: 161
Reg: Jan 30, 2016
Stonewood
2,210
02/25/16 11:00 PM (8 years ago)

HTML Doc: URL giving ios error code: -1008 iOS error message: resource unavailable

NOTE: I am leaving the original topic post below, and resulting conversation, however, I reached a conclusion that resulted in me adding a little extra error handling code to the htmlDoc plugin. Since the issue happens sporadically, never occurred more than on the first attempt to tap a link, and seems likely to be related to IP traffic delays, I am adding this new special error handling code to BT_screen_htmlDoc.m at line 673 (just below the special handling for error code -1009: //if error is 1008, show friendly 'we're experiencing internet traffic delay' message if(errorCode == -1008){ errorInfo = NSLocalizedString(@"downloadError", "There was a delay in downloading some data from the internet. Please try the link again."); } ================================ BELOW IS THE ORIGINAL TOPIC POST: ================================ I have plain vanilla HTML Doc accessed inside the app via the HTML Doc plugin. The HTML file has URLs in it. What's odd is, the first one to be clicked always gives this error: <a href="http://churchapp.me/images/IMG_6278-ios-error.jpg" target="_blank" rel="nofollow">http://churchapp.me/images/IMG_6278-ios-error.jpg</a> However, subsequent clicks of the same link or other links work correctly. I'm worried that Apple will reject the app for having "bugs" over this. Can anyone point me toward something to check?
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
02/26/16 09:12 AM (8 years ago)
Have you watched the Xcode debug window when this happens to see what it says there? It might provide some useful clues. Mark
 
DougJoseph
Aspiring developer
Profile
Posts: 161
Reg: Jan 30, 2016
Stonewood
2,210
like
02/26/16 01:35 PM (8 years ago)
Will try that. Thanks!
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
02/26/16 01:39 PM (8 years ago)
Yep! Please paste what you see there, so we can help, learn, or both! Mark
 
DougJoseph
Aspiring developer
Profile
Posts: 161
Reg: Jan 30, 2016
Stonewood
2,210
like
02/26/16 02:08 PM (8 years ago)
Below is the debug text from about when the HTML Doc page successfully loaded, through when I clicked "OK" to the error message popup. 2016-02-26 16:04:13.149 newlifetab[14209:6633955] BT_screen_htmlDoc: url scheme: file 2016-02-26 16:04:13.151 newlifetab[14209:6633955] BT_screen_htmlDoc: webViewDidStartLoad 2016-02-26 16:04:13.152 newlifetab[14209:6633955] BT_viewUtilities: getProgressView 2016-02-26 16:04:14.055 newlifetab[14209:6633955] BT_screen_htmlDoc: webViewDidFinishLoad 2016-02-26 16:04:18.623 newlifetab[14209:6633955] BT_screen_htmlDoc: shouldStartLoadWithRequest 2016-02-26 16:04:18.624 newlifetab[14209:6633955] BT_screen_htmlDoc: url to load: http://www.biblegateway.com/passage/?version=31&search=2+Corinthians+5:14-15 2016-02-26 16:04:18.624 newlifetab[14209:6633955] BT_screen_htmlDoc: url scheme: http 2016-02-26 16:04:18.660 newlifetab[14209:6633955] BT_screen_htmlDoc: webViewDidStartLoad 2016-02-26 16:04:18.660 newlifetab[14209:6633955] BT_viewUtilities: getProgressView 2016-02-26 16:04:18.878 newlifetab[14209:6633955] BT_screen_htmlDoc: shouldStartLoadWithRequest 2016-02-26 16:04:18.878 newlifetab[14209:6633955] BT_screen_htmlDoc: url to load: https://www.biblegateway.com/passage/?version=31&search=2+Corinthians+5:14-15 2016-02-26 16:04:18.878 newlifetab[14209:6633955] BT_screen_htmlDoc: url scheme: https 2016-02-26 16:04:19.207 newlifetab[14209:6633955] BT_screen_htmlDoc: shouldStartLoadWithRequest 2016-02-26 16:04:19.208 newlifetab[14209:6633955] BT_screen_htmlDoc: url to load: http://www.biblegateway.com/passage/?version=NIV&search=2+Corinthians+5:14-15 2016-02-26 16:04:19.208 newlifetab[14209:6633955] BT_screen_htmlDoc: url scheme: http 2016-02-26 16:04:19.226 newlifetab[14209:6633955] BT_screen_htmlDoc: didFailLoadWithError: iOS Error Code: -1008 iOS Error Message: resource unavailable 2016-02-26 16:04:19.242 newlifetab[14209:6633955] newlifetab_appDelegate: supportedInterfaceOrientationsForWindow 2016-02-26 16:04:19.244 newlifetab[14209:6633955] newlifetab_appDelegate: supportedInterfaceOrientationsForWindow 2016-02-26 16:04:19.245 newlifetab[14209:6633955] newlifetab_appDelegate: supportedInterfaceOrientationsForWindow 2016-02-26 16:04:19.245 newlifetab[14209:6633955] newlifetab_appDelegate: supportedInterfaceOrientationsForWindow 2016-02-26 16:04:19.246 newlifetab[14209:6633955] newlifetab_appDelegate: supportedInterfaceOrientationsForWindow 2016-02-26 16:04:19.247 newlifetab[14209:6633955] newlifetab_appDelegate: supportedInterfaceOrientationsForWindow 2016-02-26 16:04:19.247 newlifetab[14209:6633955] newlifetab_appDelegate: supportedInterfaceOrientationsForWindow 2016-02-26 16:04:19.248 newlifetab[14209:6633955] newlifetab_appDelegate: supportedInterfaceOrientationsForWindow 2016-02-26 16:04:19.331 newlifetab[14209:6633955] newlifetab_appDelegate: supportedInterfaceOrientationsForWindow 2016-02-26 16:04:19.332 newlifetab[14209:6633955] newlifetab_appDelegate: supportedInterfaceOrientationsForWindow 2016-02-26 16:04:39.800 newlifetab[14209:6633955] BT_screen_htmlDoc: alertView (super) clickedButtonAtIndex: 0
 
DougJoseph
Aspiring developer
Profile
Posts: 161
Reg: Jan 30, 2016
Stonewood
2,210
like
02/26/16 02:08 PM (8 years ago)
Note regarding above: I only tapped the hyperlink once.
 
DougJoseph
Aspiring developer
Profile
Posts: 161
Reg: Jan 30, 2016
Stonewood
2,210
like
02/26/16 02:12 PM (8 years ago)
Could it that the web server of the desired URL (for the link that I am tapping on) is a bit slow to respond the first time (or delayed by IP traffic routing) and thus gives an error due to a timeout? Does anyone know where to look in the BT_screen_htmlDoc.m to find a timeout that could possibly be increased?
 
DougJoseph
Aspiring developer
Profile
Posts: 161
Reg: Jan 30, 2016
Stonewood
2,210
like
02/26/16 02:14 PM (8 years ago)
The plugin seems to have a customized way to gracefully handle a code 1009, but does not have any built in special handling, or any mention at all, of error code 1008.
 
DougJoseph
Aspiring developer
Profile
Posts: 161
Reg: Jan 30, 2016
Stonewood
2,210
like
02/26/16 02:40 PM (8 years ago)
A possible work around. Does anyone know how to make hyperlinks inside a doc being viewed with the plugin... when tapped, to cause the targeted page to open in native browser instead of inside the plugin view?
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
02/26/16 02:43 PM (8 years ago)
Have you tried using the Custom URL plugin instead of the HTML Doc plugin? I'm wondering if that would make a difference? Mark
 
DougJoseph
Aspiring developer
Profile
Posts: 161
Reg: Jan 30, 2016
Stonewood
2,210
like
02/26/16 02:49 PM (8 years ago)
I think I chose the HTML Doc plugin (instead of the Custom URL plugin) because of caching. The Custom URL plugin notes say: "Webpages load in a built in browser and refresh each time intentionally" Anyhow I had read a thread on here that caused me to switch about all my use of Custom URL to HTML Doc plugin.
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
02/26/16 02:52 PM (8 years ago)
Fair enough. It seems to me that it's timing out getting the resource that your URL requests. I'm not sure where in the code to set a timeout period...I'll do some investigating later today if I can. Have you tried other URLs to see if they experience the same issue? Mark
 
DougJoseph
Aspiring developer
Profile
Posts: 161
Reg: Jan 30, 2016
Stonewood
2,210
like
02/26/16 03:04 PM (8 years ago)
There are several URLs in the current document, and they all behave the same way. Will check further into the app.
 
DougJoseph
Aspiring developer
Profile
Posts: 161
Reg: Jan 30, 2016
Stonewood
2,210
like
02/26/16 03:05 PM (8 years ago)
What I mean by the above is, no matter which URL I click, the first time always gives the error, and then that URL and others all work fine. Only the first click of anyone of them gives the error. Doing more checking.
 
DougJoseph
Aspiring developer
Profile
Posts: 161
Reg: Jan 30, 2016
Stonewood
2,210
like
02/26/16 03:22 PM (8 years ago)
Well, I just tried to do more testing, and now the issue cannot be reproduced. ?? I guess "mileage varies" depending perhaps on IP traffic trace routing, etc. Perhaps the issue will not crop up often, and my app will get approved. I have it uploaded to iTunes Connect, pending review. Fingers crossed.
 
DougJoseph
Aspiring developer
Profile
Posts: 161
Reg: Jan 30, 2016
Stonewood
2,210
like
02/26/16 03:27 PM (8 years ago)
Since the issue happens sporadically, never occurred more than on the first attempt to tap a link, and seems likely to be related to IP traffic delays, I am adding this new special error handling code to BT_screen_htmlDoc.m at line 673 (just below the special handling for error code -1009: //if error is 1008, show friendly 'we're experiencing internet traffic delay' message if(errorCode == -1008){ errorInfo = NSLocalizedString(@"downloadError", "There was a delay in downloading some data from the internet. Please try the link again."); }
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
02/26/16 04:12 PM (8 years ago)
Rock on! Great solution! Good luck with the app...I like the content subject! Mark
 
DougJoseph
Aspiring developer
Profile
Posts: 161
Reg: Jan 30, 2016
Stonewood
2,210
like
02/26/16 04:55 PM (8 years ago)
Thanks!
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.