I'm writing a wrapper component for WKWebView and I'd like to make sure I cover my bases for error handling.
The documentation for webView:didFailNavigation simply states Called when an error occurs during navigation. What exactly does the documentation writer mean when they say "navigation?"
I'm aware that there's also webView:didFailProvisionalNavigation, which executes whenever there's a loading error. The documentation for that hook states Called when an error occurs while the web view is loading content. I can make this trigger by calling [_webView loadRequest:request], where request contains a malformed URL.
Related
The project I'm working on already has a "custom" error handler but I have a task to make another one which handles only one exception. My question is can the two handlers co-exist and if yes - where do I set mine to be used by the project?
According to Documentation page about handling errors:
You can customize the default error handling by implementing a custom ErrorHandler and enabling it with setErrorHandler() in any of the components in the component hierarchy, including the UI, or in the VaadinSession object.
That means that what you need to do is most likely doable, and exception will be handled by first error handler it arrives at - unless you want to have two error handlers on the same component (i.e. UI) which is impossible.
I'm trying to track Page Load Event. I'm getting utag.js from Omniture.
I'm also wrapping it with jQuery: $.getScript to make sure that script is loaded.
But even then if I try to set my s.pageName or s.t(); I'm getting error that s is undefined. If I put a 500 ms timeout everything works fine. But I'm surprised that I need to wait even after script is loaded. Is it a common practice with Omniture?
I'm new to the Omniture, it might be very obvious thing for the more experienced users of Omniture.
utag.js is a Tealium loader, which I assume has Adobe Analytics code within it. The only thing that would prevent s from being defined after utag.js being loaded would be that the appmeasurement code is being loaded asynchronously.
You can find more about asynchronous loading here: https://tealium.com/blog/standard/asynchronous-tagging/
I would expect that once you switched to synchronous loading, the variables after utag.js will be able to reference the appmeasurement library.
App Measurement is not designed to be loaded asynchronously. I would suggest adding a "flag" that will indicate when utag.js has loaded and then reference the s.object.
I have an app that builds a dynamic list of files to be downloaded, using the Amazon S3 iOS SDK. No matter where in the queue I start the downloading from, the same file consistently crashes the application.
I've pinpointed the problem using breaks, and it's coming from my S3GetObjectMetadataResponse line as I attempt to get the size of the file before downloading, for the sake of configuring the progress bar.
self.S3 = [[AmazonS3Client alloc] initWithAccessKey:#"xxxxxxxxxxxxxxxxxxxx" withSecretKey:#"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"];
S3GetObjectMetadataRequest *getMetadataRequest = [[S3GetObjectMetadataRequest alloc] initWithKey:self.file.fileName withBucket:[self.file contentURLBucket]];
S3GetObjectMetadataResponse *metadataResponse = [self.S3 getObjectMetadata:getMetadataRequest];
If I comment out the last line, everything works as intended - except for the progress bar, of course.
What can I do to handle S3GetObjectMetadataResponse errors? Is there a better way I can check the file size before downloading?
Thanks!
As mentioned in my comment, you'll want to ensure that either exceptions are disabled in the AWS SDK for iOS or that you use a #try/#catch block in your code around synchronous calls when using the SDK.
This post on our blog explains how to disable exceptions and how to work with the SDK when exceptions are disabled.
This post is the first in a series that explains the various methods for using the SDK asynchronously. It is worth noting that if you make asynchronous requests with exceptions enabled you don't need the #try/#catch blocks.
When I run my application it works well, but during transitions between its views I have a lot of CGContext errors in the console output, but the app still works well, no crashes or bugs I didn't see. Description: so I only run my app - all work well - but there appears error messages in the console:
And after any other view transition they appear again and again. So the question - how to fix this? And what may be the reason of this error messages? There a lot of views and code in my application so I don't even know what part is error-prone.But these messages appear after transitions between all views in my app. Thanks in advance.
Look for some method in your code where you call CGContextSaveGState, CGContextSetBlendMode, CGContextSetApha, etc. Chances are that you won´t find many places where you do that.
Well, if you find it, look for some statement (just before those listed in your console log) where a context is created, and try to understand why it fails. You may set a breakpoint on that line and inspect the parameters to the CGContextCreate call.
If you need more help, paste the code you have (hopefully) found.
I couldn't find it anywhere on Mozilla's documentation. Suppose I code an extension that uses addEventListener on keypress. What is the execution priority if a webpage contains a JS code that calls addEventListener on keypress (or keydown) too? Is it guaranteed that my extension receives the event first?
The event first goes through a "capturing" phase, then a "bubbling" phase. If you use the capturing phase (by putting true as the last parameter to addEventListener) then your listener will get called before the one on the page, if the one on the page uses the bubbling phase. I guess if you don't know which way it works on the page, then you could just attach it to something out of reach of the page (like the browser object, or even gBrowser) and then you would be sure that yours goes first. See http://www.w3.org/TR/DOM-Level-3-Events/#event-flow