Ios 如何在SceneDelegate中拥有颤振方法处理程序?

Ios 如何在SceneDelegate中拥有颤振方法处理程序?,ios,swift,flutter,Ios,Swift,Flutter,我有一个music Flatter应用程序,现在我正在swift中实现本机播放器代码。该应用程序与spotify ios sdk集成 我正在尝试运行,而spotify connect功能在IOS 13.6手机上不起作用,我发现IOS 13+更高版本需要SceneDelegate 现在我被困在如何在SceneDelegate中添加颤振方法处理程序中 当我在SceneDelegate上添加颤振方法处理程序时,我得到以下错误,它将被卡在断点处,下一步不会执行 我试图通过以下AVFoundation文档

我有一个music Flatter应用程序,现在我正在swift中实现本机播放器代码。该应用程序与spotify ios sdk集成

我正在尝试运行,而spotify connect功能在IOS 13.6手机上不起作用,我发现IOS 13+更高版本需要SceneDelegate

现在我被困在如何在SceneDelegate中添加颤振方法处理程序中

当我在SceneDelegate上添加颤振方法处理程序时,我得到以下错误,它将被卡在断点处,下一步不会执行

我试图通过以下AVFoundation文档制作一个简单的视频取景器。应用程序每次启动时都会终止。如何解决此特定错误

Thread 1: EXC_BREAKPOINT (code=1, subcode=0x102d3c320)

以下步骤帮助我将颤振应用程序与SceneDelegate一起使用

  • 创建
    SceneDelegate.swift
    包含子类
    UIResponder
    ,并符合
    UIWindowSceneDelegate
  • SceneManifest
    添加到
    Info.plist
    ,其中我们将SceneDelegate声明为场景的默认配置
  • 更新
    SceneDelegate.swift
    以支持iOS 13+

  • 颤振不支持SceneDelegate,将其与颤振一起使用是错误的做法
    @available(iOS 13.0, *)
    class SceneDelegate: UIResponder, UIWindowSceneDelegate {
        
        var window: UIWindow?
        //....
    
    }
    
    <key>UIApplicationSceneManifest</key>
        <dict>
            <key>UIApplicationSupportsMultipleScenes</key>
            <true/>
            <key>UISceneConfigurations</key>
            <dict>
                <key>UIWindowSceneSessionRoleApplication</key>
                <array>
                    <dict>
                        <key>UISceneConfigurationName</key>
                        <string>Default Configuration</string>
                        <key>UISceneDelegateClassName</key>
                        <string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
                        <key>Storyboard Name</key>
                        <string>Main</string>
                    </dict>
                </array>
            </dict>
        </dict>
    
        override func application( _ application: UIApplication,
                                   didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
            guard #available(iOS 13.0, *) else {
                GeneratedPluginRegistrant.register(with: self)
                guard let controller = window?.rootViewController as? FlutterViewController else { return true }
                //Confugure 'controller' as needed
                return super.application(application, didFinishLaunchingWithOptions: launchOptions)
            }
            return true
        }
    
        func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
    
            guard let windowScene = scene as? UIWindowScene else { return }
            
            window = UIWindow(windowScene: windowScene)
            let flutterEngine = FlutterEngine(name: "SceneDelegateEngine")
            flutterEngine.run()
            GeneratedPluginRegistrant.register(with: flutterEngine)
            let controller = FlutterViewController.init(engine: flutterEngine, nibName: nil, bundle: nil)
            window?.rootViewController = controller
            window?.makeKeyAndVisible()
        }