iPhone app emulated on an iPad

30 views
Skip to first unread message

Dave Jarvis

unread,
Aug 31, 2015, 5:25:14 PM8/31/15
to phonegap

Hi,


I have a first generation iPad (practically brand new) running iOS 5.1.1. Here is what I tried:

  1. Start iPad.
  2. Launch App Store.
  3. Search for "phonegap developer"
  4. Tap "GET"
  5. Tap "INSTALL APP"
  6. Tap "Download" when prompted "The current version requires iOS 6.0 or later, but you can download the last compatible version."
  7. Tap "PhoneGap" icon.

The "LOADING..." screen appeared, then the app closed abruptly, leading me to think that it crashed.


I do not know what version of PhoneGap is being installed because the version number did not appear, nor did a crash window appear to indicate the problem. It simply vanished. Here is what I was expecting to see:

  • A window to stay open on the iPad
  • The ability to select a simulator (iPhone vs. iPad)
  • The IP address of the iPad for connecting via the CLI

Here is what I would like to do:

  • Use Ubuntu Linux to develop an iPhone app using the PhoneGap CLI.
  • Use the first generation iPad to simulate an iPhone for testing purposes.
  • Submit the iPhone app to the App Store (via the iPad) -- I am unclear on this part, but it's not yet important.
Is this possible? If not, what alternatives are there?

I do not own any other iOS devices. For details see: http://stackoverflow.com/q/32303293/59087

Thank you!

Kerri Shotts

unread,
Aug 31, 2015, 6:02:17 PM8/31/15
to phonegap
Dave:

PhoneGap Dev App isn't made to simulate anything -- it provides a PhoneGap environment + some plugins for your app to run inside so that you don't have to deploy an IPA. It's useful during testing and development, especially for occasions when one is making rapid changes to code followed by tests to see the results. Furthermore, you're not going to be able to simulate an iPhone on an iPad -- the app is designed to be used on the device you want to use to test (not to simulate other devices). [Oh, you could try hard and come close with some code on your part, but an iPad will /never/ give the same experience as the actual device you're targeting.]

Second, I doubt using such an old version of the dev app would work. So, I think you're out of luck with an iPad 1. Furthermore, recent versions of Cordova/PhoneGap also require iOS6 or higher.

As to what you'd like to do:
  • You can dev on Ubuntu with PhoneGap CLI / Dev App, but you'll have to have a device capable of running the PhoneGap Developer app. You should have an iPhone or an iPod Touch if you are targeting iPhone-sized devices. Frankly, since we now have larger devices, it would be best to get an iPhone 6/6+, but that's dependent upon your budget.
    • Note: for building, you need either PG Build or a Mac with Xcode 6.
  • A first generation iPad is no longer sufficient or capable. The underlying system browser is out-of-date, and you can't accurately simulate an iPhone to deal with the important parts (size of elements, touchable areas, status bars, etc.) Never mind that the original iPad had 128mb of RAM. This was inadequate then, and woefully so now. It wouldn't surprise me if the dev app simply ran out of memory and crashed.
  • You need a Mac to submit your app -- period. No ands, ifs, or buts.
In short:
  • Buy/Rent/Beg use of one from a friend a Mac for app distribution
  • Buy an iPod Touch/iPhone for testing on phone-sized form factors
Consider it "cost of doing business".

Dave Jarvis

unread,
Aug 31, 2015, 8:01:15 PM8/31/15
to phonegap
Thank you, Kerri.

I have a working environment, but it's dreadfully slow and cumbersome. Here's the setup:
  • Xubuntu with PhoneGap CLI (with Hello, World app), running on 10.0.1.2:3000.
  • OS X Yosemite running in VirtualBox, with IP of 10.0.2.15, and can successfully ssh to 10.0.1.2.
  • The ios-sim installed on Yosemite.
My understanding (from http://phonegap.com/blog/2014/04/23/phonegap-developer-app/) is that I could run PhoneGap Developer on the Yosemite machine and connect to Linux on 10.0.1.2:3000. This doesn't appear to be the case because the PhoneGap Developer GUI doesn't seem to provide an option to specify the IP address, only a port number.

From there, the page notes that I can update files to see immediate changes in the PhoneGap Developer App.

However, the PhoneGap server cannot be used for development purposes between Linux and a virtual machine.

What I can do, though, is build the Hello World application then run it through ios-sim:

ios-sim launch ./platforms/ios/build/emulator/Hello\ World.app

This means that the development workflow follows:
  1. Make changes in Linux.
  2. Commit changes into repository.
  3. Switch to Virtual Machine.
  4. Pull changes from repository.
  5. Build.
  6. Close iOS Simulator.
  7. Run ios-sim to see new updates.
If there's an easier way to perform real-time development while using Linux as the development environment and Yosemite to simulate the iOS environment (e.g., iPhone), I'd be glad to know it.

Thanks again!

Kerri Shotts

unread,
Aug 31, 2015, 9:57:05 PM8/31/15
to phonegap
Dave,

I fear you've overcomplicated things greatly...

1) Yosemite is slow on VMs for some dumb reason. But there is a fix (after logging in): https://derflounder.wordpress.com/2014/12/13/improving-yosemite-vm-performance-in-vmware-fusion/

2) PhoneGap Desktop App is intended to /serve/ applications to the PhoneGap Developer App. It reads to me like you're trying to do the opposite? Leave the desktop app out of it for the moment. [But this is why it only lets you specify a port -- you're specifying which port on localhost to serve from, not which address to connect to...]

3) PhoneGap CLI has "phonegap serve" -- this lets you also serve an app to the PhoneGap Developer App. You can use this on Windows, Linux, and Mac OS X.

So for development, you could stick with your Yosemite VM for now or use Linux. Either way, my suggested setup is the same:

a. PhoneGap CLI installed
b. "phonegap serve" from your app's project directory
c. On your iOS device, launch the PhoneGap Developer App
d. On your iOS device, enter the IP and port number of your machine (if using Yosemite VM, use the IP assigned to the VM)
e. Test. Editing files within the app directory should automatically reload the app on your device.

To /distribute/ your app, you'll have to have to do that from Mac OS X. Since you have a working VM, you should be good. 

NOTE: The Yosemite VM is NOT a supported method for iOS development. Apple's license permits it only on existing Mac hardware, so chances are pretty good you're violating the license. Deal with that as you will. From a technical perspective, you may have issues with system updates and the like, but as long as you can keep it up-to-date, it should function just fine -- just out of the license scope.

You've also mentioned ios-sim -- you can start a simulator using Phonegap: "phonegap emulate ios" from the project directory. You still need ios-sim installed on Yosemite, but it's easier to start it up IMO. Do keep in mind that the simulator does not accurately reflect the app's performance or feel -- you must install it on a physical device to ensure that it works the way you expect.

Hope that helps...

Dave Jarvis

unread,
Sep 1, 2015, 3:13:25 PM9/1/15
to phonegap
Hi again,


c. On your iOS device, launch the PhoneGap Developer App

I believe that's the core problem I'm trying to solve.

I have a first generation iPad (practically brand new) running iOS 5.1.1, which is incompatible with PhoneGap Developer App. I do not have any other iOS devices.

So for the iOS device, can I use ios-sim (on Yosemite) with PhoneGap Developer App?

Thank you!

Kerri Shotts

unread,
Sep 1, 2015, 4:31:12 PM9/1/15
to phonegap
Well, there's little point to use the PhoneGap Developer App if you've got access to the iOS Simulator -- just build your app and run directly:

phonegap emulate ios  // use --target <device> to target a specific form factor, like --target iPhone-5s

You don't get the file watching capability, but the build & deployment process isn't so onerous on your dev machine. You could probably build the Developer App to work on the sim, but I've never tried.

It's possible you could point your iPad at the machine running "phonegap serve" and the port you specified (default is 3000, IIRC). You won't get file watching there either, but it should load the page in Mobile Safari. It's FAR from perfect, but perhaps sufficient. Again, though, I suggest getting a real phone-sized device (either iPhone or iPod Touch).

Again, though, the simulator is not a completely accurate simulation: there are many things that you can't test and many others that are misleading (memory, processing speed). In short: you need at least one real device of each form factor you are targeting (and is recent enough to support development). If you don't have one you need to buy one. 

Yes, this gets expensive -- but that's the cost of doing iOS development. You don't necessarily need every model (I don't have a 6/6+ yet), but you should have representative devices (I have a 5s and an iPad 3). Come Apple's new product releases, I'll almost certainly be buying a new iPhone and iPad for development purposes (my ipad 3 is long in the tooth, and my 5s is no longer terribly representative of the form factors Apple is targeting). 

Finally note that this isn't just an iOS thing: it's an issue for ALL mobile development. It's not cheap to do well!


Jesse Monroy

unread,
Sep 1, 2015, 4:33:17 PM9/1/15
to phonegap
@Dave,
an iPod Touch is about $200, and recently Apple moved them to self-serve in the Apple stores.
You will still need to pay Apple $100 to be an Apple Developer.

Jesse
Reply all
Reply to author
Forward
0 new messages