didFailProvisionalNavigation error not localized - ios

I have a localized app. I use WKWebView and also make some network requests. All the app localization works as expected. But errors from webView:didFailProvisionalNavigation:withError are always in English. I haven't found any information about any bugs on WebKit or Error side, but localizedDescription is always in English. Why?
Steps to reproduce:
Just create WKWebView and assign its delegate to self;
handle webView:didFailProvisionalNavigation:withError;
Enable airplane mode, switch off wifi and try to load any page;
You'll get connection error with wrong localization.

Finally, I have found a confirmation, that it's an Apple bug.

Related

Call "didFailLoadWithError" when no internet connection?

I already googled but didn't find a clear answer. When is "didFailLoadWithError" called? I want to use it to show an alert when there's no internet connection. Is that the right way?
It's for my iOS app made with Xcode and Swift.
didFailLoadWithError method will get called in the following conditions:
If the URL redirects to another URL, we will receive an
NSURLErrorCancelled error.
If the page contains links to the AppStore, tapping the link will return an error (but the AppStore link will still be handled by
iOS).
If the URL is a direct link to a Video/Audio, we will receive an error (“Plug-in handled load”) even if the video/audio will play.
So the best solution to check network is to use apple Reachability code.
Update:
The best solution to check for Internet connection (Wi-Fi and cellular) is: [Reachability Swift 2][2]

iOS - Chromecast - app not loading media

I have a problem with launching media from iOS app. When I call mediaControlChannel loadMedia:, nothing happens on receiver app - no loading bar appears, but neither of GCKMediaControlChannelDelegate methods are being called. After waiting some time, when I disconnect from the device, only then delegate receives didFailToLoadMediaWithError with error 92: unexpected disconnect.
I thought that the media or some of the parameters are incorrect, so I used them in Google's example iOS app, but it all works fine there.
Before trying to load media I check if I'm connected to device and to the application, mediaControlChannel is added to deviceManager. I also call requestStatus on mediaControlChannel to make sure I don't get kGCKInvalidRequestID and everything's fine. Only then I try to load media, but as I said - it just doesn't work, no error, no feedback from receiver app. I'm out of ideas.

Catching the crash log on iOS

The main idea is to catch the crash log (or the reason of the error) and send it to a server.
I know that iTunes does log the crashes from the users' devices but I need to find if there's a way to get it and store it on our server.
I was trying "PlCrashReporter" and i finished implementing it (as they did on this link https://www.plcrashreporter.org/documentation/api/v1.0/example_usage_iphone.html).
Problem
The function applicationDidFinishLaunching is not called when the crash occurs.
Am I on the right track?
Is there a specific function which is called upon a crash in AppDelegate ?
Thanks in advance
EDIT
I've also tried the solution of the following question:
iOS crash log catch, debug info.. Catch and send via email to the Dev team
It actually works but there are some errors that are cause by Swift and not Objective-C (Like Error while unwrapping optional value) were not caught..
Any suggestions?
You should use Crashlytics. You then can use a custom web hook to receive the crash reports.

com.google.GCKError Code=2 when connecting to ChromeCast device

I'm working on an iOS app where I now want to integrate ChromeCast support. I use the HelloGoogleVideoCast example to test my hardware setup and get inspiration for my app.
I have now stumbled on a problem that is present both in my app and in HelloGoogleVideoCast. When I connect to a device (connectToDevice method in HelloGoogleVideoCast) I get error "The operation couldn’t be completed. (com.google.GCKError error 2.)". I have power-cycled the device with no change in behavior. I never get to the callback deviceManagerDidConnect, instead deviceManager:didFailToConnectWithError is called with this error. Still, I can connect with the iOS YouTube app.
I can't find anything with substance if I google it and I can't find any good ChromeCast developer forums.
Is there anybody who has an inroad to how to solve this?
I m not sure it will help but u can try:
Download the Chromecast app from app store:
chromecast link
After u see your chromecast -> select your chromecast -> General -> make sure both check box are selected (I know the text is nothing to do with your problem).
Try now.
If the error still occur, try to reboot your chromecast.
If your error still occur, try to reset your chromecast, and then check the boxes again (don't forget!).
Make sure that you initialize the Receiver Manager in your receiver app as soon as possible. Don't wait for the window.onload. If the receiver takes too long to load and initialize the receiver manager, the connection is automatically torn down.
I had the same problem as you did and making the following changes on receiver worked for me:
I've put the script src="//www.gstatic.com/cast/sdk/libs/receiver/2.0.0/cast_receiver.js" inside head tag and before title tag;
I've put my script file which managed all cast functions after
body tag (actually I've put all script declarations, except for cast_receiver, after body tag, including jQuery);
I hope it can help you yet :)

How to handle UIWebView cases were no connection, and should I use Network indicator?

What´s the preferred way of handling an app that an integral part of it is using UIWebView, the first view the user sees when app is first loaded is a UIWebView trying to access a webpage... If the connection is slow or if there is no connection at all - how should I handle this?
also, does UIWebView require you to use the network indicator (spinner) when it´s using the network?
Always try to provide feedback to the user, it helps in increasing usability. So, yes spinners(activity and network indicators) are very useful. You might also learn a lot by looking at other apps as to how they handle network errors. Facebook for example shows a nice message saying "Network Unreachable, Try again". You can implement actions like this which will always let the user know how to proceed.
As to handling network connection, Apple provides Reachability class. Look at the attached example to understand how to implement this -
https://developer.apple.com/library/ios/samplecode/Reachability/Introduction/Intro.html
you can use activityindicator to show loading....
and then stop indicator in UIWebView delegate method
-(void)webViewDidFinishLoad:(UIWebView *)webView

Resources