0
votes

Using the Worklight v6.0.0 code sample/tutorial "Integrating server-generated pages in hybrid applications" (http://public.dhe.ibm.com/software/mobile-solutions/worklight/docs/v600/IntegratingServerGeneratedPagesProject.zip) allows for the web content to be integrated. The code sample doesn't work in iOS 7/XCode 5. When show web view overlay page, it shows white blank page.

However, Android version works fine.

How can I get the WebViewOverlay to work on iOS 7/XCode 5?

1

1 Answers

0
votes

I'm using Worklight Studio 6.0.0.20130926-1933, Xcode 5.0.2 and the iOS 7.0.3 simulator. When I first imported the project, it crashed on startup. It was something about iOS7, because it worked on the iOS6 simulator.

I deleted the iPhone environment and re-created it (including the customizations in the iPhone environment's css and js folders, and installed the WebViewOverlay plug-in in Xcode) and the crash was fixed. At that point the app worked fine, and the WebViewOverlay opened and populated with content. But it wouldn't close. I had to modify the close() method in WebViewOverlayPlugin.m

- (void)close:(CDVInvokedUrlCommand*)command{
    NSLog(@"WebViewOverlayPlugin :: close");

    WLCordovaAppDelegate *appDelegate = (WLCordovaAppDelegate*) [[UIApplication sharedApplication] delegate];

    if ([[[appDelegate window] subviews] count] > 1) {
        UIView *appView = [[[appDelegate window] subviews] objectAtIndex:1];

        for (UIView *view in [appView subviews]){

            if (view.tag==12345) {

                [view removeFromSuperview];
            }}
    }
}

It looks like something changed since the sample was written, and objectAtIndex:0 needed to change to: objectAtIndex:1. Someone who actually knows objective c could probably do a better job with the condition I added (and explain why the change), but with the iPhone environment re-created, and the above implementation of close() it all seems to work on iOS 7.