Tag Archives: Exception

Catch JavaScript exceptions in UIWebViews

A small but useful category method on UIWebView: Turn uncaught JavaScript Exception into a NSError! // // Created by Marcus Rohrmoser on 05.12.13. // Copyright (c) 2013 Marcus Rohrmoser mobile Software. All rights reserved. //   #import "UIWebView+JavaScriptNSError.h"   #define NSERROR_UIWEBVIEW_SCRIPT @"NSERROR_UIWEBVIEW_SCRIPT" #define NSERROR_UIWEBVIEW_SCRIPT_CODE 1   @implementation UIWebView(JavaScriptNSError)   -(NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script error:(NSError * __autoreleasing *)error […]