MobileFirst Мой перенесенный проект iOS не отвечает, если я расширяю WLApDelegate, но не если я расширяю WLCordovaAppDelegate

Я перенес 9 гибридных приложений iOS с MobileFirst 6.3 на MobileFirst 7.1 с помощью MobileFirst Studio. 4 приложения работают нормально. Но у других 5 пользовательский интерфейс не реагирует на клики. В рамках автоматизированного процесса миграции заголовки этих 5 приложений (только) были изменены, чтобы ссылаться на новый интерфейс WLApDelegate. Как ни странно, я заметил, что если я переключаю свой файл AppName.h с расширения WLApDelegate обратно на расширение исходного WLCordovaAppDelegate, все работает нормально. Почему? Я бы хотел перенести этот устаревший код на ваш новый интерфейс WLApDelegate.

Мой заголовок и файл .m соответствуют значениям по умолчанию, созданным MobileFirst Studio 7.1, когда вы запрашиваете новое приложение для iOS, поэтому это должно быть что-то другое.

Вот мой нерабочий файл .h и .m

//
//  MyAppDelegate.h
//
//

#import <IBMMobileFirstPlatformFoundationHybrid/IBMMobileFirstPlatformFoundationHybrid.h>


@interface MyAppDelegate : WLAppDelegate <WLInitWebFrameworkDelegate> {

}

@end

//
//  MyAppDelegate.m
//  IssuesReturns
//
//
#import "IssuesReturns.h"
#import <IBMMobileFirstPlatformFoundationHybrid/IBMMobileFirstPlatformFoundationHybrid.h>
#import "CDVMainViewController.h"

@implementation MyAppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{
    BOOL result = [super application:application didFinishLaunchingWithOptions:launchOptions];

    // A root view controller must be created in application:didFinishLaunchingWithOptions:  
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    UIViewController* rootViewController = [[UIViewController alloc] init];     

    [self.window setRootViewController:rootViewController];
    [self.window makeKeyAndVisible];

    [[WL sharedInstance] showSplashScreen];
    // By default splash screen will be automatically hidden once Worklight JavaScript framework is complete. 
    // To override this behaviour set autoHideSplash property in initOptions.js to false and use WL.App.hideSplashScreen() API.

    [[WL sharedInstance] initializeWebFrameworkWithDelegate:self];

    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
{


    UIViewController* rootViewController = self.window.rootViewController;

    // Create a Cordova View Controller
    CDVMainViewController* cordovaViewController = [[CDVMainViewController alloc] init] ;

    cordovaViewController.startPage = [[WL sharedInstance] mainHtmlFilePath];

    // Adjust the Cordova view controller view frame to match its parent view bounds
    cordovaViewController.view.frame = rootViewController.view.bounds;

    // Display the Cordova view
    [rootViewController addChildViewController:cordovaViewController];  
    [rootViewController.view addSubview:cordovaViewController.view];
    [cordovaViewController didMoveToParentViewController:rootViewController];  
}

-(void)wlInitDidFailWithResult:(WLWebFrameworkInitResult *)result
{
    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"ERROR"
                                                  message:[result message]
                                                  delegate:self
                                                  cancelButtonTitle:@"OK"
                                                  otherButtonTitles:nil];
    [alertView show];
}


- (void)applicationWillResignActive:(UIApplication *)application
{
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

- (void)applicationDidEnterBackground:(UIApplication *)application
{
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

- (void)applicationWillEnterForeground:(UIApplication *)application
{
    // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}

- (void)applicationDidBecomeActive:(UIApplication *)application
{
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

- (void)applicationWillTerminate:(UIApplication *)application
{
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

@end

person scott dickerson    schedule 11.02.2016    source источник


Ответы (1)


WLCordovaAppDelegate — это устаревший API совместимости, упрощающий миграцию приложений до версии 6.2 в приложения версии 6.2+. Его можно использовать, но рекомендуется использовать WLAppDelegate.

person Idan Adar    schedule 14.02.2016
comment
Идан, зависание происходит только тогда, когда я пытаюсь использовать WLApDelegate. Пользовательский интерфейс совершенно не реагирует на клики. Если я вернусь к WLCordovaAppDelegate, у меня не возникнет никаких проблем. Любые идеи? Вот мой код .m.. - person scott dickerson; 18.02.2016
comment
Я пошел дальше и открыл PMR 51828 442 000, чтобы отследить эту проблему. Меня не заблокировали, так как я могу просто продолжать использовать старый проверенный WLCordovaAppDelegate, но было бы неплохо решить эту проблему, чтобы в конечном итоге я мог перейти вперед. - person scott dickerson; 18.02.2016