Worklight 6.2 web视图在iOS中第一次没有打开



我已经创建了一个继承CDVViewController的ViewController。当我试图启动viewController时它会自动解散它。然后我再次启动相同的viewController然后它工作得很好。有没有人能让我知道为什么会发生这种情况,或者是什么修复相同的。Worklight版本:6.2iOS: 7.1iphone: 5 s

AppDelegate

//
//  MyAppDelegate.h
//
//
#import "WLAppDelegate.h"
#import "WL.h"
@interface MyAppDelegate : WLAppDelegate <WLInitWebFrameworkDelegate> {
@end
//
//  MyAppDelegate.m
//
#import "AppDelegate.h"
#import "WLWebFrameworkInitResult.h"
#import "Cordova/CDVViewController.h"
@implementation Compatibility50ViewController
/**
 In iOS 5 and earlier, the UIViewController class displays views in portrait mode only. To support additional orientations, you must override the shouldAutorotateToInterfaceOrientation: method and return YES for any orientations your subclass supports.
 */
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return YES;
}
@end
@implementation MyAppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    BOOL result = [super application:application didFinishLaunchingWithOptions:launchOptions];
    [[WL sharedInstance] showSplashScreen];    
    [[WL sharedInstance] initializeWebFrameworkWithDelegate:self];
  // Launched the ViewContorller Here
    return result;
}
// This method is called after the WL web framework initialization is complete and web resources are ready to be used.
-(void)wlInitWebFrameworkDidCompleteWithResult:(WLWebFrameworkInitResult *)result {
    if ([result statusCode] == WLWebFrameworkInitResultSuccess) {
        [self wlInitDidCompleteSuccessfully];
    } else {
        [self wlInitDidFailWithResult:result];
    }
}
-(void)wlInitDidCompleteSuccessfully {
[[WL sharedInstance] hideSplashScreen];
}
-(void)wlInitDidFailWithResult:(WLWebFrameworkInitResult *)result
{
}
@end
//ViewContorller

#import "MainViewController.h"
#import "WL.h"
@interface KHybridBaseViewController : CDVViewController<UIWebViewDelegate>
@end
#import "KHybridBaseViewController.h"
@implementation KHybridBaseViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
  self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
  if (self) {
    // Custom initialization
        self.wwwFolderName = @"www/default";
    self.startPage = [NSString stringWithFormat:@"%@",[[WL sharedInstance] mainHtmlFilePath]];
  }
  return self;
}
- (void)viewDidLoad {
  [super viewDidLoad];
  // Do any additional setup after loading the view from its nib.
}
- (void) viewWillAppear:(BOOL)animated {
}
- (void)didReceiveMemoryWarning {
  [super didReceiveMemoryWarning];
  // Dispose of any resources that can be recreated.
}
#pragma mark - WebView Delegate
- (void)webViewDidFinishLoad:(UIWebView *)theWebView {
    [ super webViewDidFinishLoad:theWebView ];
}
- (void)webViewDidStartLoad:(UIWebView *)theWebView {
    [ super webViewDidStartLoad:theWebView ];
}
- (void)webView:(UIWebView *)theWebView didFailLoadWithError:(NSError *)error {
    [super webView:theWebView didFailLoadWithError:error];
}
- (BOOL)webView:(UIWebView *)theWebView
     shouldStartLoadWithRequest:(NSURLRequest *)request
                 navigationType:(UIWebViewNavigationType)navigationType {
    return [super webView:theWebView
     shouldStartLoadWithRequest:request
                 navigationType:navigationType];
}
@end

我还添加了我第一次启动屏幕时得到的日志

> 2014-07-31 12:09:20.164 sample[16948:60b] Multi-tasking -> Device: YES,
> App: YES 2014-07-31 12:09:20.167 sample[16948:60b] Unlimited access to
> network resources 2014-07-31 12:09:20.168 sample[16948:6e0f] [DEBUG]
> [WL_INIT] -[WLImpl initWL] in WLImpl.m:117 :: START 2014-07-31
> 12:09:20.244 sample[16948:60b] [CDVTimer][wlapp] 0.119984ms 2014-07-31
> 12:09:20.245 sample[16948:60b] [CDVTimer][push] 0.069976ms 2014-07-31
> 12:09:20.245 sample[16948:60b] [CDVTimer][TotalPluginStartup]
> 0.966966ms 2014-07-31 12:09:20.263 sample[16948:60b] [DEBUG] [WL_INIT] -[WLImpl _wlInitDidCompleteWithResult:] in WLImpl.m:97 :: END 2014-07-31 12:09:20.269 sample[16948:60b]
> worklight:///Users/rahul.singh1/Library/Application Support/iPhone
> Simulator/7.1/Applications/50D15A9F-732F-4EAE-9463-6F3F0366002B/sample.app/www/default/index.html
> 2014-07-31 12:09:20.271 sample[16948:60b] Resetting plugins due to page
> load. 2014-07-31 12:09:20.914 sample[16948:60b] GET_BAG_ITEMS
> 2014-07-31 12:09:20.915 sample[16948:2d07] Multi-tasking -> Device:
> YES, App: YES 2014-07-31 12:09:20.917 sample[16948:2d07] Unlimited
> access to network resources 2014-07-31 12:09:20.930 sample[16948:60b]
> log1 2014-07-31 12:09:20.944 sample[16948:60b] Failed to load webpage
> with error: The operation couldn’t be completed. (NSURLErrorDomain
> error -999.) 2014-07-31 12:09:20.946 sample[16948:2d07] [WARN] [NONE]
> Initialization option 'connectOnStartup' is deprecated. Use
> WL.Client.connect() to connect to the Worklight Server. 2014-07-31
> 12:09:20.970 sample[16948:5613] [DEBUG] [NONE] ondeviceready event
> dispatched 2014-07-31 12:09:20.972 sample[16948:6d0b] [WARN] [NONE]
> Initialization options 'enableLogger' and 'logger' are deprecated. Use
> WL.Logger.config to set logger behavior. 2014-07-31 12:09:20.972
> sample[16948:8103] [DEBUG] [NONE] wlclient init started 2014-07-31
> 12:09:20.974 sample[16948:8203] [DEBUG] [NONE] Read cookies: null
> 2014-07-31 12:09:20.975 sample[16948:1303] [WARN] [NONE] Initialization
> option 'analytics' is deprecated. Use WL.Analytics.enable/disable to
> set analytics data capture. 2014-07-31 12:09:20.975 sample[16948:8303]
> [DEBUG] [NONE] CookieMgr read cookies: {} 2014-07-31 12:09:20.976
> sample[16948:8703] [DEBUG] [NONE] before: initOptions.onSuccess
> 2014-07-31 12:09:20.977 sample[16948:8803] [DEBUG] [NONE] after:
> initOptions.onSuccess 2014-07-31 12:09:20.977 sample[16948:8a03]
> [DEBUG] [NONE] wlclient init success 2014-07-31 12:09:20.977
> sample[16948:8903] [DEBUG] [NONE] added onPause event handler 
> 2014-07-31 12:09:21.089 sample[16948:60b] *** -[NSKeyedUnarchiver
> initForReadingWithData:]: data is NULL

我不太清楚你的情况。
无论你想要这个视图控制器在Worklight之前呈现,还是在点击按钮或类似的方式之后呈现。

你可能想看看下面博客文章中提供的示例项目:使用Xcode Storyboard集成基于worklight的iOS应用

虽然博客文章讨论了如何在Xcode Storyboard上下文中这样做,但这不是必需的。它也可能是一个XIB…

这个博客展示了如何"重新订购"。

启动顺序,以便它将与故事板成为一个,并能够从Cordova视图控制器(包含Web视图)遍历到其他视图控制器。

相关内容

最新更新