uni-app iOS启动白屏,android正常,麻烦大佬看看 解决方案

发布于 1周前 作者 htzhanglong 来自 Uni-App

uni-app iOS启动白屏,android正常,麻烦大佬看看 解决方案

IOS 13.2版本启动白屏,ios15以上版本都正常, Hb版本4.08, uni小程序sdk版本4.15,日志如下  

2024-09-02 10:43:55.928750+0800 smarthome[1021:31890] [Runtime][DEBUG:] ##CoreApp##...app start load..
2024-09-02 10:43:55.929131+0800 smarthome[1021:31890] [Runtime][DEBUG:] ##CoreApp##...createAppRuntime..
2024-09-02 10:43:55.950847+0800 smarthome[1021:31890] [Runtime][DEBUG:] ##CoreApp##...createAppWindow..
2024-09-02 10:43:55.957954+0800 smarthome[1021:31890] [Runtime][DEBUG:] ##CoreApp##...创建首页..
2024-09-02 10:43:55.968789+0800 smarthome[1021:32095] <Weex>[error]script_bridge.h:168, <WeexCore> xxx set_core_side is runing and 0x283ff9d60
2024-09-02 10:43:56.026603+0800 smarthome[1021:32093] <Weex>[error]WXMonitor.m:289, [WX_KEY_EXCEPTION_WXBRIDGE] [undefined:undefined:undefined] TypeError: undefined is not an object js stack: (null)
2024-09-02 10:43:56.037587+0800 smarthome[1021:31890] [Runtime][INFO:] refreshWhitePageCheckWebview---evt[3]---[<PDRCoreAppFrame: 0x105173a00; frame = (0 0; 375 667); clipsToBounds = YES; layer = <CALayer: 0x283d68100>>
2024-09-02 10:43:56.037725+0800 smarthome[1021:31890] [Runtime][INFO:] Archiver file fullPath /var/mobile/Containers/Data/Application/DA0BE391-1FEC-473F-A594-B2F15C67BDE1/Library/Pandora/apps/UNI56C2916/data/download.plist
2024-09-02 10:43:56.038139+0800 smarthome[1021:31890] [Runtime][INFO:] Archiver file fullPath /var/mobile/Containers/Data/Application/DA0BE391-1FEC-473F-A594-B2F15C67BDE1/Library/Pandora/apps/UNI56C2916/data/upload.plist
2024-09-02 10:43:56.045177+0800 smarthome[1021:32093] <Weex>[error]WXExceptionUtils.m:38, Weex exception errCode: -9100 function: executeJsService message: [WX_KEY_EXCEPTION_INVOKE_JSSERVICE_EXECUTE] name:SERVICE_NAME,arg:TypeError: undefined is not an object,exception :$@
2024-09-02 10:43:56.043948+0800 smarthome[1021:31890] [Common] _BSMachError: port 10523; (os/kern) invalid capability (0x14) "Unable to insert COPY_SEND"
2024-09-02 10:43:56.045399+0800 smarthome[1021:32093] <Weex>[error]WXMonitor.m:289, [WX_KEY_EXCEPTION_INVOKE_JSSERVICE_EXECUTE] name:SERVICE_NAME,arg:TypeError: undefined is not an object,exception :$@
2024-09-02 10:43:56.047596+0800 smarthome[1021:32093] <Weex>[error]WXExceptionUtils.m:38, Weex exception errCode: -9100 function: executeJsService message: [WX_KEY_EXCEPTION_INVOKE_JSSERVICE_EXECUTE] name:UniApp,arg:TypeError: undefined is not an object,exception :$@
2024-09-02 10:43:56.047698+0800 smarthome[1021:32093] <Weex>[error]WXMonitor.m:289, [WX_KEY_EXCEPTION_INVOKE_JSSERVICE_EXECUTE] name:UniApp,arg:TypeError: undefined is not an object,exception :$@
2024-09-02 10:43:56.054048+0800 smarthome[1021:31890] changing items while animating can result in a corrupted navigation bar
2024-09-02 10:43:56.063143+0800 smarthome[1021:31890] <Weex>[log]WXSDKInstance.m:503, Start rendering page:app-service.js
2024-09-02 10:43:56.069878+0800 smarthome[1021:31890] [Process] kill() returned unexpected error 1
小程序打开成功
2024-09-02 10:43:56.075325+0800 smarthome[1021:31890] [Process] kill() returned unexpected error 1
2024-09-02 10:43:56.075463+0800 smarthome[1021:31890]   
2024-09-02 10:43:56.109871+0800 smarthome[1021:31890] [Process] kill() returned unexpected error 1
2024-09-02 10:43:56.109951+0800 smarthome[1021:31890] [Process] kill() returned unexpected error 1
2024-09-02 10:43:56.121624+0800 smarthome[1021:31890] [core] No URL for Apple ID Authorization
2024-09-02 10:43:56.122108+0800 smarthome[1021:31890] [Process] kill() returned unexpected error 1
2024-09-02 10:43:56.131933+0800 smarthome[1021:31890] [Process] kill() returned unexpected error 1
2024-09-02 10:43:56.132024+0800 smarthome[1021:31890] [Runtime][INFO:] check webview enable white check--[1]--manifesttarget [1]
2024-09-02 10:43:56.139154+0800 smarthome[1021:31890] [Process] kill() returned unexpected error 1
2024-09-02 10:43:56.163063+0800 smarthome[1021:31890] [Process] kill() returned unexpected error 1
2024-09-02 10:43:56.180731+0800 smarthome[1021:31890] [Process] kill() returned unexpected error 1
2024-09-02 10:43:56.256963+0800 smarthome[1021:31890] [Process] kill() returned unexpected error 1
2024-09-02 10:43:56.257115+0800 smarthome[1021:31890] [Process] kill() returned unexpected error 1
2024-09-02 10:43:56.257359+0800 smarthome[1021:31890] [Process] kill() returned unexpected error 1
2024-09-02 10:43:56.257389+0800 smarthome[1021:31890] [Process] kill() returned unexpected error 1
2024-09-02 10:43:56.257442+0800 smarthome[1021:31890] [Process] kill() returned unexpected error 1
2024-09-02 10:43:56.257698+0800 smarthome[1021:31890] [Process] kill() returned unexpected error 1
2024-09-02 10:43:56.257870+0800 smarthome[1021:31890] [Process] kill() returned unexpected error 1
2024-09-02 10:43:56.258819+0800 smarthome[1021:31890] [Process] kill() returned unexpected error 1
2024-09-02 10:43:56.259163+0800 smarthome[1021:31890] [Process] kill() returned unexpected error 1
2024-09-02 10:43:56.259361+0800 smarthome[1021:31890] [Process] kill() returned unexpected error 1
2024-09-02 10:43:56.259542+0800 smarthome[1021:31890] [Process] kill() returned unexpected error 1
2024-09-02 10:43:56.259653+0800 smarthome[1021:31890] [Process] kill() returned unexpected error 1
2024-09-02 10:43:56.259943+0800 smarthome[1021:31890] [Process] kill() returned unexpected error 1
2024-09-02 10:43:56.268825+0800 smarthome[1021:31890] [Process] kill() returned unexpected error 1
2024-09-02 10:43:56.274199+0800 smarthome[1021:31890] [Process] kill() returned unexpected error 1
2024-09-02 10:43:56.274348+0800 smarthome[1021:31890] [Process] kill() returned unexpected error 1
2024-09-02 10:43:56.279677+0800 smarthome[1021:31890] [Process] kill() returned unexpected error 1
2024-09-02 10:43:56.280783+0800 smarthome[1021:31890] [Process] kill() returned unexpected error 1
2024-09-02 10:43:56.312706+0800 smarthome[1021:32093] <Weex>[error]WXExceptionUtils.m:38, Weex exception errCode: -9700 function: func: createInstance arg:start message: [WX_KEY_EXCEPTION_WXBRIDGE] exception: SyntaxError: Unexpected token '?'
stack:(null)
2024-09-02 10:43:56.312848+0800 smarthome[1021:32093] <Weex>[error]WXMonitor.m:289, [WX_KEY_EXCEPTION_WXBRIDGE] exception: SyntaxError: Unexpected token '?'
stack:(null)
2024-09-02 10:43:56.313123+0800 smarthome[1021:31890] [Process] kill() returned unexpected error 1
2024-09-02 10:43:56.855485+0800 smarthome[1021:31890] [Process] kill() returned unexpected error 1
2024-09-02 10:43:56.864212+0800 smarthome[1021:31890] [Process] kill() returned unexpected error 1
2024-09-02 10:43:57.355310+0800 smarthome[1021:31890] [Process] kill() returned unexpected error 1
2024-09-02 10:43:57.356562+0800 smarthome[1021:31890] [Process] kill() returned unexpected error 1
2024-09-02 10:44:02.112676+0800 smarthome[1021:31890] [Runtime][DEBUG:] doSplashTimeout
2024-09-02 10:44:02.113099+0800 smarthome[1021:31890] [Process] kill() returned unexpected error 1
2024-09-02 10:44:02.113196+0800 smarthome[1021:31890] [Runtime][DEBUG:] ##DCAD--closeSplashscreen
2024-09-02 10:44:02.114192+0800 smarthome[1021:31890] [Runtime][DEBUG:] -----deviceid+(null)  

1 回复

针对你提到的uni-app在iOS平台上启动时出现白屏的问题,而Android平台表现正常,这通常可能与iOS特定的配置或代码实现有关。以下是一些可能的原因和相应的代码检查或修改方案,你可以逐一排查:

  1. 检查iOS项目配置: 确保manifest.json文件中iOS平台的配置正确无误。特别是app-plus下的distributeios等配置。

    {
      "mp-weixin": {},
      "app-plus": {
        "distribute": {
          "apple": {
            // 确保相关证书、描述文件等配置正确
          }
        },
        "ios": {
          "usingComponents": true, // 根据需要开启
          // 其他iOS特定配置
        }
      }
    }
    
  2. 检查启动页面代码: 确认启动页面的代码(通常是pages.json中配置的launch页面)在iOS上是否能正确渲染。检查是否有异步数据加载导致的渲染延迟或错误。

    // 示例:在启动页面的onLoad或mounted生命周期中检查数据加载
    onLoad() {
      this.loadInitialData().then(data => {
        // 渲染数据
      }).catch(error => {
        console.error('Failed to load initial data:', error);
      });
    }
    
    loadInitialData() {
      return new Promise((resolve, reject) => {
        // 模拟异步数据加载
        setTimeout(() => {
          resolve({ someData: 'example' });
        }, 1000);
      });
    }
    
  3. 检查原生插件或模块: 如果你使用了原生插件或模块,确保它们在iOS上已正确集成和配置。有时候,插件在Android和iOS上的实现方式可能有所不同。

  4. 调试和日志: 使用Xcode打开uni-app生成的iOS项目,运行并调试应用。查看控制台输出,检查是否有错误信息或警告。

  5. 清理和重建项目: 有时候,简单的清理和重建项目可以解决一些奇怪的问题。尝试清理Xcode的Derived Data,然后重新构建项目。

  6. 检查iOS版本兼容性: 确保你的应用兼容目标iOS版本。有时候,新的iOS版本可能会引入与旧代码不兼容的更改。

如果以上步骤仍未解决问题,建议详细检查应用的启动流程,特别是在iOS平台上的实现细节。此外,考虑在uni-app社区或相关开发者论坛寻求更具体的帮助,可能有其他开发者遇到过类似问题并找到了解决方案。

回到顶部