xcode 使用通过 Dock 连接的外部附件调试 iOS 应用程序
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3420716/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Debugging an iOS app with an external accessory connected via Dock
提问by DJ Bouche
Am I missing something glaringly obvious or is there no way to debug an iOS app which uses an external accessory that's connected via the 30-pin dock without using a bucket load of logs etc. I want to be able to use things such as breakpoints and Instruments.
我是不是遗漏了一些明显的东西,或者没有办法调试使用通过 30 针底座连接的外部附件的 iOS 应用程序,而不使用大量的日志等。我希望能够使用断点和仪器。
Is there a way to remote debug perhaps, over Wi-Fi, Bluetooth?
有没有办法通过 Wi-Fi、蓝牙进行远程调试?
Note:Yes, I asked this very recently and I deleted it because I thought I found the answer.. but the answer was only Instruments has support over Wi-Fi.. not Xcode debugging. So the question still remains...
注意:是的,我最近问了这个问题,然后我删除了它,因为我认为我找到了答案.. 但答案是只有 Instruments 支持 Wi-Fi .. 而不是 Xcode 调试。所以问题仍然存在......
And so...:Given that I've had no real luck finding the answer, and no one has given me an answer as yet - I take it that it is a big fat NO. :(
所以......:鉴于我没有真正的运气找到答案,而且还没有人给我答案 - 我认为这是一个很大的NO。:(
Makes me wonder are we just expected to magically guess where bugs occur, or log the crap out of everything while wearing out our dock connectors by continuously moving it back and forth between the device and accessory?
让我想知道我们是否只是期望通过在设备和附件之间不断来回移动来神奇地猜测错误发生的位置,或者在磨损我们的扩展坞连接器的同时记录所有垃圾?
Time to file a bug report I guess.
我猜是时候提交错误报告了。
采纳答案by Pete Kruckenberg
At CES today, I talked to a developer from Wahoo Fitness that makes an ANT+ accessory for iPhone. They had this same problem, but found a solution.
在今天的 CES 上,我与 Wahoo Fitness 的一位开发人员进行了交谈,该开发人员为 iPhone 制作了 ANT+ 配件。他们遇到了同样的问题,但找到了解决方案。
They found a pass-through dock extender that has a mini-USB port. They used the mini-USB port for debugging while the accessory was connected.
他们找到了一个带有迷你 USB 端口的直通式扩展坞。他们在连接附件时使用迷你 USB 端口进行调试。
The product they were using is http://www.cablejive.com/products/dockStubz.html
他们使用的产品是http://www.cablejive.com/products/dockStubz.html
This blogtalks about remote debugging iOS with a dock accessory attached
这篇博客讨论了附加了扩展坞附件的远程调试 iOS
回答by hotpaw2
You could connect the external accessory to another iOS device (not the one tethered to the Mac running the Xcode debugger). Then tunnel all your EA framework messages from the accessory connected device to the device running the app being debugged over a pair of wifi sockets. Look at the code for tunneling accelerometer messages from a device to the iOS Simulator (a common trick for debugging game code on the Simulator) for one example of how this could be done.
您可以将外部配件连接到另一台 iOS 设备(而不是连接到运行 Xcode 调试器的 Mac 的设备)。然后将所有 EA 框架消息从附件连接设备传输到运行正在调试的应用程序的设备,通过一对 wifi 套接字。查看用于将加速度计消息从设备隧道传输到 iOS 模拟器的代码(在模拟器上调试游戏代码的常用技巧),了解如何完成此操作的一个示例。
回答by DJ Bouche
After further researching, and having seen that people had to do sending strings over Wi-Fi to get around this, I'm concluding the answer is no.
经过进一步研究,并看到人们必须通过 Wi-Fi 发送字符串才能解决这个问题,我得出的结论是,答案是否定的。
I have filed a bug request for this.
我已经为此提交了一个错误请求。
In the mean time, it seems like the Wi-Fi logging, and on-device text logging will be the way to go for now.
与此同时,似乎是 Wi-Fi 日志记录,而设备上的文本日志记录将是目前要走的路。
回答by Gamma-Point
Here's my understanding for why just the USB protocol works for some external accessories and doesn't for other external accessories. Looks like a fundamental problem, without an arbitrator, two masters can't talk to a single slave over USB, a serial Master/Slave protocol. So XCode is one master, the iPhone is the slave device. If the external accessory is a master too, one won't be able to connect the iPhone (Xcode slave) to the second master (the external accessory).
这是我对为什么 USB 协议仅适用于某些外部附件而不适用于其他外部附件的理解。看起来是一个基本问题,没有仲裁器,两个主设备无法通过 USB(串行主/从协议)与单个从设备通信。所以 XCode 是一个主设备,iPhone 是从设备。如果外部附件也是主设备,则无法将 iPhone(Xcode 从设备)连接到第二个主设备(外部附件)。
Probably the Wahoo Key for iPhone" is a slave device and that's why the dockStubz solution works for such an external accessory.
可能用于 iPhone 的 Wahoo Key”是一个从设备,这就是为什么 DockStubz 解决方案适用于这样的外部附件。
I have tested the dockStubz. It doesn't work for my external accessory. As suspected, the USB protocol can't be used to have two Master devices controlling a single slave device. Trying to hook up a Mac (Master) (via the mini USB ) & an external accessory (Master) (via the 30 pin connector) to the iPhone 4 (Slave) causes the iPhone to go in loop of connect & re-connect.
我已经测试了dockStubz。它不适用于我的外部配件。正如怀疑的那样,USB 协议不能用于让两个主设备控制单个从设备。尝试将 Mac(主)(通过迷你 USB)和外部配件(主)(通过 30 针连接器)连接到 iPhone 4(从)会导致 iPhone 进入连接和重新连接循环。
Following looks promising too, though expensive: digi.com/support/kbase/kbaseresultdetl.jsp?id=485.
以下看起来也很有希望,但价格昂贵:digi.com/support/kbase/kbaseresultdetl.jsp?id=485。
Has any one tried to use USB to Ethernet connectors and use a router to route requests from two masters (XCode & External Accessory) to the slave (iPhone)? I am off to Best Buy to purchase USB to Ethernet cables and hook all three on to my IP router. Will report if it works.
有没有人尝试使用 USB 到以太网连接器并使用路由器将来自两个主设备(XCode 和外部附件)的请求路由到从设备(iPhone)?我要去 Best Buy 购买 USB 转以太网电缆并将所有三个连接到我的 IP 路由器。如果有效会报告。
This is what will be needed : http://www.bestbuy.com/site/IOGEAR+-+USB+Ethernet+Extender/9614781.p?id=1218131339965&skuId=9614781&st=USB%20to%20Ethernet&cp=1&lp=1
这是需要的:http: //www.bestbuy.com/site/IOGEAR+-+USB+Ethernet+Extender/9614781.p?id=1218131339965& skuId=9614781& st=USB%20to%20Ethernet& cp=1&lp=1
http://www.frys.com/product/6103339
http://www.frys.com/product/6103339
- So connect XCode mac using the male end into the USB slot of your computer. . Use a ethernet cable to connect this to a router.
- Connect the iPhone to the female part of the IO gear connector. Connect it to the router via ethernet cable.
- Connect the external accessory with the male connector (Sabrent USB to Fast Ethernet Network Adapter.) Connect it to router.
- 所以使用公头将XCode mac 连接到计算机的USB 插槽中。. 使用以太网电缆将其连接到路由器。
- 将 iPhone 连接到 IO 齿轮连接器的母头部分。通过以太网电缆将其连接到路由器。
- 使用公接头(Sabrent USB 至快速以太网网络适配器)连接外部配件。将其连接到路由器。
I am still researching if this will work. Just ordered the parts. Will get it by Friday & will report back then.
我仍在研究这是否有效。刚订购了零件。将在周五之前收到并届时报告。
Update: The IOGear male end draws too much current when connected to router. Also, the female end can't charge iPhone when connected to the router even when 5V USB current supplied.
更新:当连接到路由器时,IOGear 公端消耗太多电流。此外,即使提供 5V USB 电流,母端连接到路由器时也无法为 iPhone 充电。
So tried to directly connect the iPhone to the USB slot of the router (used for printers). It does charge the iPhone. Also used USB to Fast Ethernet Network Adapter (BestBuy had one to connect Wii via USB) to connect the Mac to the router. It did connect to internet but couldn't find the iPhone. In the router client list I don't see any login entires for the iPhone. So this experiment was a failure unless someone have other pointers.
所以尝试将iPhone直接连接到路由器的USB插槽(用于打印机)。它确实为 iPhone 充电。还使用 USB 到快速以太网网络适配器(BestBuy 有一个通过 USB 连接 Wii)将 Mac 连接到路由器。它确实连接到互联网,但找不到 iPhone。在路由器客户端列表中,我没有看到任何 iPhone 的登录信息。所以这个实验是失败的,除非有人有其他指点。