如何在Flutter插件中调试iOS本机代码? [英] How to debug iOS native code in a flutter plugin?

查看:163
本文介绍了如何在Flutter插件中调试iOS本机代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何在插件中调试flutter的iOS代码吗?我可以打开创建插件时生成的示例应用程序,但是我将插件代码视为二进制框架,因此无法对其进行调试.

I'm wonder how to debug flutter iOS code in a plugin? I can open the example app that's generated whenever you create a plugin but I see the plugin code as binary framework, therefore I can't debug it.

对于android来说,这相当容易,我只是打开A.S.中的android文件夹.还有插件+示例,我只需添加运行配置,然后立即开始调试.

For android it's fairly easy, I just open the android folder in A.S. and the plugin + the example are there, I just add run configs and I start debugging right away.

但是我真的希望为iOS找到类似的方法.

But I really hope to find a similar way for iOS.

推荐答案

要设置断点并从Xcode调试Flutter插件代码,请尝试以下操作:

To set a breakpoint and debug Flutter plugin code from Xcode, try the following:

  1. 打开要调试的Flutter应用程序的 ios/Runner.xcworkspace .
  2. Debug 菜单中,选择断点> 创建符号断点...
  3. Symbol 字段中,输入您要使用的中断方法.例如,要中断 HelloPlugin 类中定义的插件的默认入口点,请将符号设置为-[HelloPlugin handleMethodCall:result:] .
  4. 通过产品> 运行从Xcode运行您的应用.
  1. Open ios/Runner.xcworkspace for the Flutter application you want to debug.
  2. From the Debug menu, select Breakpoints > Create symbolic breakpoint...
  3. In the Symbol field, enter the method you want to break on. For example, to break on the default entrypoint for the plugin defined in the HelloPlugin class, set the symbol to -[HelloPlugin handleMethodCall:result:].
  4. Run your app from Xcode via Product > Run.

从那时起,通过将要触发相关代码的UI操作触发插件代码.

From that point, trigger the plugin code through whichever UI actions will hit the code in question.

这篇关于如何在Flutter插件中调试iOS本机代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆