Epic Saga Chapter 6: Wherein I learn to Remotely Build and Run on the iOS Simulator But Am Ultimately Disappointed
This post is the sixth post in the series: Uploading Images from PhoneGap/Cordova to Azure Storage using Mobile Services
In the previous chapter of my epic saga to create a Cordova app that uploads binary images files directly to Azure Blob storage, I got the Android emulator running, but when I went to deploy and run my app, the sad emulator would not accept the captured image—the check button literally did nothing. I knew it was a longshot, but I thought as a last ditch attempt why not try the iOS simulator.
I still don’t have an iOS device, but I had previously borrowed the MacBook Pro from work. I had read that Cordova (or was it PhoneGap?) supported remote deployment to the iOS simulator from a Windows computer to a Mac with XCode installed. After a bit or research into the Multi-Device Hybrid Apps extension for Visual Studio (aka. Cordova extension), I discovered that with a bit of configuring on both side of the connection, this was indeed possible.
According to the docs, all I needed to do was run the following command on the Mac side:
sudo npm install -g vs-mda-remote --user=$USER
This installed the vs-mda-remote module on the Mac, which enables a service to run and listen for build (and someday debug) commands. Then I just started the build server on the Mac by running this command (from my Cordova directory):
Here’s what happened:
This is all, of course, in the docs. In fact, there were a bunch of other supposed requirements in the docs (that I didn’t meet and just ignored), but it still worked fine for me. Did I mention that remote debugging isn’t yet supported? Bummer—looking forward to that one.
Back on my own computer, I needed to set the remote server info, including the port in the terminal output on the Mac, in Visual Studio here:
At this point, I could set the platform to iOS and the debug to iPhone simulator and F5 it.
The build/deploy started in my Visual Studio and then shifted over to the Mac, where the app successfully started (sadly without debugging). This is what I saw after the simulator started and the data was loaded:
So far so good. Then I tried to add a new item…nothing happened. Not good. I dug around in the build folder until I located the console.log file under remote-builds\XXXXX\CordovaApp\platforms\ios\cordova\
Camera not available! OK, not a surprise and this was easy to verify using Bing/Google. Well, at least I learned how to remote deploy to iOS on the Mac.
At this point, I could rewrite my app to also get images from the camera roll (assuming the simulator has preinstalled images), but I would rather just find an Android device…I guess it’s time to go shopping.
Stay tuned in for the next installment… Chapter 7: Wherein I break down and go hunting for a used Android device that runs KitKat .