【问题标题】:Visual Studio hangs when remote debugging a Cordova iOS app远程调试 Cordova iOS 应用程序时 Visual Studio 挂起
【发布时间】:2015-04-30 15:04:40
【问题描述】:

我使用带有“Apache Cordova 工具”的 Visual Studio 2013。在 Cordova 工具的设置页面“远程代理配置”中,我启用了 iOS 远程处理。

在远程调试 iOS Cordova 应用程序期间,当我设置断点以检查 cordova 插件的结果时,Visual Studio 挂起。然后我需要重新启动 Visual Studio。

在调用 Cordova 插件之前执行的行上的断点可以正常工作...也可以将 Cordova 插件的结果存储在变量中,然后使用另一个单击事件处理程序对其进行检查。

其他人是否也注意到了这个问题?你能解决它吗?

【问题讨论】:

  • 了解更多细节会很有用。您能否分享代码 sn-p 以及有关您正在使用的插件的更多信息?如果您使用相同的插件构建并部署到 Android 或 WinPhone,是否也会发生这种情况?其他插件也会这样吗?
  • 插件是什么?其他插件会导致同样的问题吗?
  • 我使用cordova文件插件和2个自写插件。他们都有同样的问题。在下面的文章中,Rick 说他可以毫无问题地使用调试:weblog.west-wind.com/posts/2015/Jan/06/…

标签: visual-studio cordova remote-debugging visual-studio-cordova


【解决方案1】:

我对自己编写的插件也有同样的问题。

尝试让您的插件在后台线程中运行。然后调试应该没有问题。看下面的代码sn -p:

- (void)myMethod:(CDVInvokedUrlCommand*)command
{
       NSString* callbackId = command.callbackId;

       [self.commandDelegate runInBackground:^{
             // your plugin logic comes here

             // successful plugin execution
             CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:@"success"];
             [self.commandDelegate sendPluginResult:pluginResult callbackId:callbackId];
       }

       return;
}

【讨论】:

  • 非常感谢 hirtenfelder。这解决了我自己编写的插件的调试问题。但是使用 Cordova 文件插件我仍然有同样的问题......
猜你喜欢
  • 1970-01-01
  • 2012-04-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-12-06
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多