Want to develop on your actual iPhone device from your Windows PC using the official Apple XCode tools running under VMWare?
If you’re a professional developer who has to develop for multiple operating systems, you often want to be able to debug on your target devices without having to have a separate machine to do it on.
I’ve been developing for iPhone and iPad for quite some time now, and whilst I have a Mac laptop, I don’t like using it all that much for development, primarily because my desk just isn’t big enough for yet another computer and peripherals and monitors. I would rather run Mac OS X on top of VMWare as a guest operating system of my Windows 7 workstation.
It’s trivial to get XCode installed and running to let you use the iPhone or iPad simulator, but what about downloading your code to a physical device and actual debugging?
That last bit is surprisingly easy so here’s how you do it.
I will assume you have your Mac OS X installed on VMWare, your XCode and iPhone SDK is all set up properly, and you can build and run projects successfully under the device simulator.
To get access to physical device debugging, you need to install iTunes on your Microsoft Windows host operating system as well as on the guest Apple Mac OS X. Obviously Mac OS X comes with iTunes installed by default but depending on which version of the OS you installed, you may need to update it. I know this works with 9.0.2 and 9.2, earlier versions I have yet to test.
You do not need to be running the same version of iTunes on both guest Mac OS X and Windows. Just so long as both operating systems have it installed.
Start up your Mac OS X virtual machine and once it is running, connect your iPhone or iPad to your Windows PC. Your device should make the “connected tone” and if you have iTunes on Windows to start synchronization automatically, that should proceed as normal.
Either wait for the sync to complete or cancel it, whichever is your pleasure.
Once you’re connected and synchronization is no longer taking place, switch back to your VMWare window, and in the lower right corner of the window, where all of the icons reside for the status of various devices you should see one for your iPhone or iPad device.
On my machine, it looks like this:
That’s the second icon from the right, that looks like a little digital camera.
Right click on the icon and you will see the following context menu will pop up.
Select the first option, “Connect (Disconnect from Host)” and your iPhone or iPad will disconnect from Windows and reconnect to Mac OS X. Pretty simple, but very few people talk about doing this obvious step, and most blogs just mention getting XCode installed under VMWare.
At this point, you’re now free to proceed with on-device debugging and testing as though the device were connected to a real Mac.
Now, for whatever reason I cannot get iTunes on the Mac OS X guest operating system to see my iPad, but XCode talks to it just fine, allowing me to browse the logs, restore the image, etc. C’est la vie.
I can confirm this little trick works for both jail broken devices and also devices that have been provisioned for development through the normal channels.
Next stop: SenseCam for the iPhone.