Skip to content

微信回调时出现错误IOS异常,安卓正常 #719

@virskor

Description

@virskor

回调时返回,其他SDK是正常的

fvm flutter run
[ERROR:flutter/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm(178)] Attempting to open an URL without a Flutter RootViewController.

AppDeletage.swift

import Flutter
import UIKit

@main
@objc class AppDelegate: FlutterAppDelegate {

  var navigationController: UINavigationController!

  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {

    let controller = window?.rootViewController as! FlutterViewController
    GeneratedPluginRegistrant.register(with: self)

    // create and then add a new UINavigationController
    self.navigationController = UINavigationController(rootViewController: controller)
    self.window.rootViewController = self.navigationController
    self.navigationController.setNavigationBarHidden(true, animated: false)
    self.window.makeKeyAndVisible()

    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }

  override func application(
    _ application: UIApplication,
    didReceiveRemoteNotification userInfo: [AnyHashable : Any],
    fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
        // 警告: 需要重写当前方法,gtsdk的接管系统方法就会生效,否则会影响回执
        // 保持空实现
  }

}
fvm flutter doctor -v
[✓] Flutter (Channel stable, 3.32.8, on macOS 15.5 24F74 darwin-arm64, locale zh-Hans-KR) [6.2s]
    • Flutter version 3.32.8 on channel stable at /Users/weizhang/fvm/versions/3.32.8
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision edada7c56e (6 days ago), 2025-07-25 14:08:03 +0000
    • Engine revision ef0cd00091
    • Dart version 3.8.1
    • DevTools version 2.45.1
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0) [3.2s]
    • Android SDK at /Users/weizhang/Library/Android/sdk
    • Platform android-35, build-tools 35.0.0
    • ANDROID_HOME = /Users/weizhang/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
      This is the JDK bundled with the latest Android Studio installation on this machine.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment (build 21.0.6+-13391695-b895.109)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.4) [1,596ms]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16F6
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web [12ms]
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2025.1) [11ms]
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 21.0.6+-13391695-b895.109)

[✓] VS Code (version 1.102.2) [10ms]
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.114.0

[!] Proxy Configuration [10ms]
    • HTTP_PROXY is set
    ! NO_PROXY is not set

[✓] Connected device (3 available) [5.9s]
    • iPhone (mobile) • 00008120-001A43612613C01E • ios            • iOS 18.5 22F76
    • macOS (desktop) • macos                     • darwin-arm64   • macOS 15.5 24F74 darwin-arm64
    • Chrome (web)    • chrome                    • web-javascript • Google Chrome 138.0.7204.170

[✓] Network resources [843ms]
    • All expected network resources are available.

! Doctor found issues in 1 category.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions