# Why does my p5js game not work for iPhones?

**URL:** <https://discourse.processing.org/t/why-does-my-p5js-game-not-work-for-iphones/891>\
**Category:** p5.js\
**Created:** [June 12, 2018, 7:18am UTC](https://discourse.processing.org/t/why-does-my-p5js-game-not-work-for-iphones/891 "2018-06-12T07:18:59Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![helloDolly](https://avatars.discourse-cdn.com/v4/letter/h/b782af/32.png) [@helloDolly](https://discourse.processing.org/u/helloDolly)\
**Post date:** [June 13, 2018, 11:27am UTC](https://discourse.processing.org/t/why-does-my-p5js-game-not-work-for-iphones/891/4 "2018-06-13T11:27:40Z")

</div>

So I got everything to display on my iPhone 4 by eliminating two js bugs.

First I had a couple functions which I set a default value for the parameters. Apparently this is a no-no in js but Android and PC let it slide. If you use default params in js they have to be of the ‘null / false’ variety.

Second, I used a few **for loops** of the following variety:

```auto
for (let card of cards) {
    card.x++;
}

```

These didn’t work and I switched them to:

```auto
for (var i = 0; i < cards.length - 1; i++) {
    cards[i].x++
}

```

I figure this is an iPhone4 thing cause it’s old and that is a newish for loop.

This got everything to at least display, but not to start the game. I’m using ‘weinre’ to get a console output from the phone (but it’s not outputting what I’d expect it to, like: console.log(“hello world”);, or error messages ).

My function “function mouseClicked() {do stuff}” doesn’t seem to do anything. It’s supposed to start the “loop()”. However something sends the message “start ios!” to my console whenever the screen is touched.

My googlefu has been unable to decode the meaning of this message (“start ios!”). It’s probably incredibly simple. Does anyone know what it means? Btw: this is the only console msg my phone has sent over ‘weinre’, and I don’t know why ☹

Through the ‘weinre’ console on my PC I can send the “loop()” command to the phone and the game will start up. “mousePressed()” seems to work to move the character around although the iPhone4 runs it very slowly…

Maybe tomorrow I’ll migrate the “mouseClicked()” commands to “mousePressed()”. I tried a quick solution tonight, but it was unfruitful.

Any feedback is appreciated.

Anyone know what this “start ios!” console output is about? Lastly Chrome doesn’t output that message to my console. Only Safari.

---

_[View the full topic](https://discourse.processing.org/t/why-does-my-p5js-game-not-work-for-iphones/891)._
