Search code examples
javascriptioscocoa-touchuiwebviewuiwebviewdelegate

UIWebView shouldStartLoadWithRequest not called in iOS 4.3


UIWebView's shouldStartLoadWithRequest is fired by javascript with

window.location = updateappdata://type/viewName/;

and it works perfectly in ios 5.0, 5.1, 6.0

However in ios 4.3 only some of updateappdata:// callbacks are called, not all shouldStartLoadWithRequest is called. Any ideas what is wrong?


Solution

  • Problem was in setting uiwebviews scrollview's delegate to viewcontroller through subview.

    if ([[subview class] isSubclassOfClass: [UIScrollView class]])
    {
         [((UIScrollView *)subview) setDelegate: self];
    }
    

    Since in iOS 5.0+ there is .scrollView property, everything worked correctly there.