Cordova App on iOS device- Cannot debug from Visual Studio

ⅰ亾dé卋堺 提交于 2019-12-24 07:05:03

问题


When my app has been successfully build and deployed through remotebuild it starts, but I never get any feedback in the JavaScript console and it doesn't break on breakpoints.

  • Developing on a Windows 10 machine with Visual Studio 2015 CE (office)
  • Connect over VPN to my Mac
  • iOS device (iPad mini) has local connection to development PC

I went through this page to configure everything: https://taco.visualstudio.com/en-us/docs/ios-guide/

The only thing that shows up in the JavaScript console after the app has started on my device is: Current window: file:///var/containers/Bundle/Application/51E50D1A-C71D-4C84-A67D-D5162B8C7595/com.domain.appname.app/www/index.html


回答1:


I also have this Visual Studio debugger issue after the updates to OSX and iOS several weeks ago. Microsoft says they're working on a fix: https://github.com/Microsoft/remotebuild/issues/14 The following workaround may be obvious to folks who work with Cordova outside of VS, but it wasn't to me, maybe because I've always used the VS debugger. Hopefully, this will save someone some time.

After reading a bunch of stuff on the web, my workaround is to use my Mac's Safari Web Inspector debugger to step through my iOS Cordova app on my device. Here is a quick summary of the steps to take: http://geeklearning.io/apache-cordova-and-remote-debugging-on-ios/ You also need to enter this command from your Mac Terminal

defaults write com.bundle.identifier WebKitDeveloperExtras -bool true

as described in Apple's documentation: https://developer.apple.com/library/content/documentation/AppleApplications/Conceptual/Safari_Developer_Guide/GettingStarted/GettingStarted.html#//apple_ref/doc/uid/TP40007874-CH2-SW1

So my work flow is to build and deploy my iOS cordova app from VS to my Mac in an iPhone Simulator. Once the app in my Mac Simulator launches, close it and then navigate to the app.xcodeproj in my Mac's Finder and launch the Xcode project. You have to unhide files on your Mac so you can navigate down your .taco_home path to the Xcode project. Connect my iPhone or iPad to my Mac and deploy the app to the iOS device from Xcode. Close Xcode. Next, with the iOS device connected to the Mac, relaunch the app in the device. Now launch Safari on the Mac. Navigate Safari > Develop > Your Device > Your App and boom, you're using the Web Inspector debugger on your Mac to step through your app's Javascript, set breakpoints, look at values and actually find bugs. Make sure the iOS device's Web Inspector is enabled: Setting > Safari > Advanced > Web Inspector > Enabled. Hope this helps someone.



来源:https://stackoverflow.com/questions/39039537/cordova-app-on-ios-device-cannot-debug-from-visual-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!