Preview Hype project in XCode Simulator


(Alex) #1

Hi there,
I don’t know if there’s a way to do this already, but it would be great to be able to preview Hype projects directly in the Simulator app bundled with Xcode.
Hype Reflect is great for me to double check my project is looking ok in my ancient iPhone, however, as someone who doesn’t own an iPad, it would be great to be able to check how it looks/works on Xcode’s Simulator app running the latest virtual iOS devices.
I’ve tried previewing in my desktop version of Safari and then copying this URL to the virtual iPad’s URL bar in iOS Safari but, I guess because of security, it doesn’t work.
Would it be at all possible for Hype to detect Simulator running and then offer the virtual device in the menu of its Preview dropdown? It would save the round trip of my uploading the whole project to an FTP site and then previewing it online.
The only other way I’ve made work is by exporting it to a local folder and viewing it from there - but I’ve found that some canvas copying elements of my project don’t work when locally previewed because of CORS issues.
While typing this I’m guessing that it probably isn’t possible, since the Simulator locks down certain URLs (you can’t access the App Store from there, for example). Worth a check, though…
Thanks


(Jonathan Deutsch) #2

The simulator changed at some point (a few releases ago perhaps?) and no longer opens URLs directly like a mac app or declares itself as capable of doing so. Before then, Hype had some extra support to have this work even!

But in investigating just now to figure out if there’s a new way, it looks like you can use the terminal command:

xcrun simctl openurl booted "http://URL_HERE"

This can work with Hype’s preview server URLs, and I’ve added an item on our todo list to use this in a future version so we can restore the functionality.

Instead of FTP’ing, you may want to check out using Hype Reflect. It lets you send Hype documents to your iOS device for previewing. It also has an open in Safari button that may help. (especially since we need to update some of the screen sizes for modern devices!)


(Alex) #3

Hi Jonathan,
Bookmarking that trick! Thanks for the speedy reply.
Yeah - I use Hype Reflect for my iPhone, but as I don’t have an actual iPad, I’ve become quite reliant on Simulator.
Thanks for the tip.


(Alex) #4

Terminal’s firing the error
xcrun: error: unable to find utility “simctl”, not a developer tool or in PATH
I’ve currently got an instance of Simulator running. Don’t know if that will affect it.
Strange.


(Jonathan Deutsch) #5

My copy was running when I tried the command.

You may want to check to see if xcode-select is pointing at the right copy of Xcode:

deutschj@TumultBook9 ~> xcode-select -p
/Applications/Xcode.app/Contents/Developer
deutschj@TumultBook9 ~> xcrun --find simctl
/Applications/Xcode.app/Contents/Developer/usr/bin/simctl

(Alex) #6

Fantastic. Thanks. I’ve pointed it to the right place now (I think…)


(Alex) #7

Perfect! Thanks so much for your help, Jonathan.


#8

Wrapping would do it… Wrapping – Export Hype HTML to an App 🎁 …I’ve been waiting for the launch of Hype 4 to make a final decision on how I get this software back online. It could return as an App or as an Export Script. I’m not sure yet. I’m not really happy with any of the options, so it’s a matter of picking the best of the worst – which includes not releasing it. :slightly_frowning_face: