3

I am using UIWebView to navigate to different websites in my app. The app works fine on iPhone 5S but crashes on large HTML for iPhone 6 Plus

I am creating the UIWebView in ViewController and adding it to the view using self.view.addSubView(UIWebView object)

The constraints I have are only constraints between the navigation bar and the UIWebView. In other words, there are no vertical constraints.

When I load a large html ( Wikpedia page about Tom Brady), the UIWebView crashes. IT does not happen on iPhone 5S device.

Is there a known issue with UIWebView on iPhone 6 Plus? Is there a work around?

Mukesh Ram
  • 6,248
  • 4
  • 19
  • 37
shrutim
  • 1,058
  • 2
  • 12
  • 21
  • Are you able to use WKWebView instead of UIWebView? WKWebView is available as of iOS 8.0 and is the preferred web view class to use. – socaljoker May 21 '15 at 22:45
  • 2 reasons why i am not using wkwebview: I have not been able to take full web page screenshot for wkwebview and 2. In my xcode simulator the content is not loaded when didfinishnavigation is called http://stackoverflow.com/questions/30291534/wkwebview-didnt-finish-loading-when-didfinishnavigation-is-called-bug-in-wkw – shrutim May 22 '15 at 00:58
  • Can you share the log for the crash? What is the actual reason for the crash? Are you sure it's the size of the HTML content? – socaljoker May 22 '15 at 01:36
  • I synced my iPhone with iTunes and I did not notice any .crash files under the Mobile device logs folder. Also the app has crashlytics setup that didnt fire any crashes... So app abruptly closing while loading a UIWebView doesnt mean it is crashing? What else could it be? – shrutim May 22 '15 at 01:55
  • Run it from Xcode either on your device or in the simulator and trigger the crash. What prints out in the console when it crashes? Does it show the offending line of code? If it just says that it lost the connection with the device, that's an indication that the app ran out of memory. – socaljoker May 22 '15 at 02:01
  • did you find out what was the problem? @shrutim – Yonatan Vainer Feb 13 '16 at 23:23
  • Yes, I actually did.. The problem is that the screenshot code temporarily renders the view in-memory which causes a sudden spike in the memory used. iOS then immediately categorizes my app as a misbehaving app and shuts it down. I could not find any alternative other than settling with the screenshot for visible portion of screen. HTH – shrutim Feb 14 '16 at 21:37

0 Answers0