瀏覽代碼

[new]处理ios报错问题

zk 3 月之前
父節點
當前提交
3379e42cce
共有 1 個文件被更改,包括 6 次插入5 次删除
  1. 6 5
      lib/main.dart

+ 6 - 5
lib/main.dart

@@ -41,16 +41,17 @@ void main() {
     //非隐私相关
     initCommon();
 
-    runApp(const MyApp());
-
-    //隐私相关:系统参数&第三方sdk初始化
-    await PrivacyCompliance.ensurePolicyGranted(AppInitTask());
-
     ///实现推送
     if (Platform.isIOS) {
+      // ⚠️ 必须在 runApp 前
       initPushNotification();
     }
 
+    runApp(const MyApp());
+
+    //隐私相关:系统参数&第三方sdk初始化
+    await PrivacyCompliance.ensurePolicyGranted(AppInitTask());
+
     //檢查地址
     checkEnv();
   });