帖子
帖子
用户
博客
课程
显示全部楼层
13
帖子
0
勋章
114
Y币

[superwebview] 升级了最新的XCode以后App运行异常了

[复制链接]
发表于 2019-5-21 16:56:22
因为测试的iPhoneX手机系统升级了,连带的XCode也一起升了级,原来好好的程序现在打开白屏了,请教一下是为啥呢?

代码在下面:

AppDelegate.m中的代码
  1. #import "AppDelegate.h"
  2. #import "APIManager.h"
  3. #import "APIWindowContainer.h"
  4. #import "APIEvent.h"
  5. #import "APIWebView.h"
  6. #import "APIScriptMessage.h"
  7. #import "APIModuleMethod.h"
  8. #import "UZAppUtils.h"
  9. #import "WebView.h"

  10. @interface AppDelegate ()

  11. @end

  12. @implementation AppDelegate

  13. APIWindowContainer *windowContainer=nil;
  14. MyWebView *webview=nil;
  15. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  16.     APIConfiguration *configuration = [[APIConfiguration alloc] init];
  17.     // 调试时可以开启WiFi代码同步功能
  18.     configuration.enableWifiSync = NO;
  19.     [[APIManager sharedManager] initSDKWithLaunchOptions:launchOptions configuration:configuration];

  20.     self.window=[[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];

  21.     NSString *url = @"widget://index.html";
  22.     NSString *name = @"index";

  23.     webview=[MyWebView new];
  24.     UINavigationController *nav=[webview loadURL:url winName:name];
  25.     self.window.rootViewController=nav;
  26.     //[nav setNavigationBarHidden:NO];
  27.     return YES;
  28.    

  29. }


  30. - (void)applicationWillResignActive:(UIApplication *)application {
  31.     // 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.
  32.     // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
  33. }


  34. - (void)applicationDidEnterBackground:(UIApplication *)application {
  35.     // 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.
  36.     // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
  37. }


  38. - (void)applicationWillEnterForeground:(UIApplication *)application {
  39.     // 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.
  40. }


  41. - (void)applicationDidBecomeActive:(UIApplication *)application {
  42.     // 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.
  43. }


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


  47. @end
复制代码
WebView.m中的代码:
  1. //
  2. //  WebView.m
  3. //  member
  4. //
  5. //  Created by 苍狼 on 2019/2/13.
  6. //  Copyright © 2019 苍狼. All rights reserved.
  7. //

  8. #import <Foundation/Foundation.h>
  9. #import "WebView.h"
  10. #import "ApiWebView.h"
  11. #import "APIEvent.h"
  12. #import "APIScriptMessage.h"
  13. #import "APIModuleMethod.h"
  14. #import "APIManager.h"
  15. #import "UZModule.h"
  16. #import <objc/runtime.h>

  17. #import <WebKit/WebKit.h>

  18. @implementation MyWebView
  19. //APIWindowContainer* windowContainer;
  20. -(UIViewController*)loadURL:(NSString *)url winName:(NSString *)winName{
  21.     //NSString *url = @"widget://index.html";
  22.     NSString *name = @"index";
  23.     APIWindowContainer *windowContainer = [APIWindowContainer windowContainerWithAttribute:@{@"url":url, @"name":name}];
  24.     [windowContainer startLoad];
  25.    
  26.     UIViewController *vc=windowContainer;//[[UIViewController alloc] init];
  27.     UINavigationController *nav=[[UINavigationController alloc] initWithRootViewController:vc];
  28.    
  29.     return nav;
  30. }
复制代码
症状是显示白屏,代码跟踪的话,发现Index.html是正常加载,webViewDidFinishLoad 事件也有正常收到。
希望大神帮忙查看一下,感谢。
13
帖子
0
勋章
114
Y币
WebView.h中的代码:
  1. //
  2. //  WebView.h
  3. //  member
  4. //
  5. //  Created by 苍狼 on 2019/2/13.
  6. //  Copyright © 2019 苍狼. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. #import <Foundation/Foundation.h>
  10. #import "APIWindowContainer.h"
  11. @interface MyWebView : NSObject

  12. //@public:
  13. -(UINavigationController*) loadURL:(NSString *)url winName:(NSString *)winName;


  14. @property APIWindowContainer *windowContainer;
  15. @property id *webView;
  16. @end
复制代码
42
帖子
4
勋章
1万+
Y币
我帮你带贴问下
13
帖子
0
勋章
114
Y币

谢谢版主!
28
帖子
1
勋章
1万+
Y币
好好分析下index.html中的代码,什么情况下会导致白屏,找到具体原因。
13
帖子
0
勋章
114
Y币
技术咨询-Kenny 发表于 2019-5-21 17:35
好好分析下index.html中的代码,什么情况下会导致白屏,找到具体原因。

已经解决了。。。我好像改了Index.html网页的标题!
多谢多谢。
您需要登录后才可以回帖 登录

本版积分规则