我正在尝试将Flutter添加到现有的ios应用中。因此,在添加到生产应用程序之前,我决定先带一些演示应用程序。独立的flutter应用程序在android和ios中都可以正常工作。即使在现有的ios应用中,除插件外,它都可以正常工作。我遵循了教程并运行了所有命令,例如 流畅运行,干净干净,但没有任何东西可以在现有应用中正常工作。在执行Pod安装时,它表明它正在添加插件并为其获取相关文件,但是当我使用该应用程序时,它会抛出以下错误
2020-07-29 11:49:17.631598+0530 ex2[62300:807253] flutter: Observatory listening on
http://127.0.0.1:59471/oDJ2--syl-g=/
2020-07-29 11:49:18.701965+0530 ex2[62300:807244] [VERBOSE-2:ui_dart_state.cc(157)]
Unhandled Exception: MissingPluginException(No implementation found for method resync on
channel razorpay_flutter)
#0 MethodChannel._invokeMethod
(package:flutter/src/services/platform_channel.dart:154:7)
<asynchronous suspension>
#1 MethodChannel.invokeMethod
(package:flutter/src/services/platform_channel.dart:329:12)
#2 Razorpay._resync (package:razorpay_flutter/razorpay_flutter.dart:100:35)
#3 Razorpay.on (package:razorpay_flutter/razorpay_flutter.dart:90:5)
#4 _MyAppState.initState (package:razorpay_flutter_example/main.dart:41:15)
#5 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4640:58)
#6 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4476:5)
#7 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3446:14)
#8 Element.updateChild (package:flutter/src/widgets/framework.dart:3214:18)
#9 RenderObjectToWidgetElement._rebuild
(package:flutter/src/widgets/binding.dart:1148:16)
#10 RenderObjectToWidgetElement.mount (package:flutter/src/widgets/binding.dart:1119:5)
#11 RenderObjectToWidgetAdapter.attachToRenderTree.<anonymous closure>
(package:flutter/src/widgets/binding.dart:1061:17)
#12 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2607:19)
#13 RenderObjectToWidgetAdapter.attachToRenderTree
(package:flutter/src/widgets/binding.dart:1060:13)
#14 WidgetsBinding.attachRootWidget (package:flutter/src/widgets/binding.dart:941:7)
#15 WidgetsBinding.scheduleAttachRootWidget.<anonymous closure>
(package:flutter/src/widgets/binding.dart:922:7)
#16 _rootRun (dart:async/zone.dart:1180:38)
#17 _CustomZone.run (dart:async/zone.dart:1077:19)
#18 _CustomZone.runGuarded (dart:async/zone.dart:979:7)
#19 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1019:23)
#20 _rootRun (dart:async/zone.dart:1184:13)
#21 _CustomZone.run (dart:async/zone.dart:1077:19)
#22 _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:1003:23)
#23 Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:23:15)
#24 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398:19)
#25 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429:5)
#26 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)
下面是我的AppDelegate.swift
import UIKit
import Flutter
// Used to connect plugins (only if you have plugins with iOS platform code).
import FlutterPluginRegistrant
@UIApplicationMain
class AppDelegate: FlutterAppDelegate {
lazy var flutterEngine = FlutterEngine(name: "my flutter engine")
override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
// Runs the default Dart entry point with a default Flutter route.
flutterEngine.run();
// Used to connect plugins (only if you have plugins with iOS platform code).
GeneratedPluginRegistrant.register(with: self.flutterEngine);
return super.application(application, didFinishLaunchingWithOptions: launchOptions);
}
}