Jump to content

iOS 8/Mobile Safari Problems


kenray
 Share

Recommended Posts

I'm having some memory issues running our Phaser-based app on iOS 8... the app is semi-complex*, but at its core it just presents a series of interactive screens that have graphics, simple animations, and audio. When it ran under iOS 7 on "older" iPads (the non-retina iPad mini that has 512MB RAM for example), it ran pretty well and didn't suffer from memory issues. But ever since I updated it to iOS 8 (including all versions up to the current 8.1.2), it will only play a few "pages" and then it crashes Mobile Safari.

 

The graphics are tiny (most of them are 10-30K), even the background image for a page is small in dimension (315x236), and the animations are pretty simple as well. The audio that plays is tiny in size (around 40K) and at most there are two sounds playing at once. I'm currently using .m4a for audio (although I've tried other formats and got the same result.

 

I have gone to great lengths to make sure that I'm not loading duplicate copies of assets, and I'm disposing of them before going to the next page. The app is 23 pages, and when it was on iOS 7 we were preloading all the elements before the app runs for smoothness of playback and the best experience. When we do that under iOS 8, we can only get through preloading and maybe a couple of pages at best before it crashes.

 

I've tried an alternate mode where we *don't* preload everything, and just load and play one page at a time, and even in *that* mode, it can't get more than about 1/2 way before it dies (and you also see a black screen between each  page as it shifts between states).

 

I have tried all versions of Phaser from 2.07 through the current 2.2.1, and although I get a slightly better result with older versions of Phaser, that doesn't seem to really be addressing the issue.

 

I've spent the last two weeks trying everything I can think of - can you guys take a look and let me know if there's anything I've overlooked or need to change in the app to make it run under iOS 8 like it did in iOS 7? 

 

The app is located here: http://interactplayer.com/apps/debug/index.html. (When the main screen displays, click anywhere except the 'Activities Menu' button to start it running.)

 

Anything you can think of, even wild ideas, would be appreciated...

 

Thanks!

 

Ken

 

* We run the 'boot' state first, which sets up the world dimensions, then the 'preloader' state which reads a config file to determine how many pages to load and then either preloads all the pages or only the first page (depending on whether the 'preloadAllPages' flag is set to true or false in the config file), and then the 'pageplayer' state is called to display and run the page. When the user chooses to navigate to another page, we jump to another instance of the 'pageplayer' state while the previous one runs through its 'shutdown' function, so it's:

 

      boot -> preloader -> pageplayer --> pageplayer --> pageplayer ... etc.

Link to comment
Share on other sites

Did you try running the game with sound completely disabled? In my (non-Phaser) experience iOS8 safari seems to have quite different sound handling to previous versions so it's possible the crashing is audio related. If it still crashes even with no sound loaded then you'll know that this is not the case. I've had to make quite a few revisions to my own sound manager that previously worked fine on iOS6 and 7 to prevent crashes on iOS8 where it appeared to now be referencing sound channels that no longer existed for example.

If that doesn't get you anywhere maybe you could try using this console log viewer to catch and view any error messages while running on the device.

Link to comment
Share on other sites

In regards to the graphics I don't think their size in number of k has any relevance it is their size in dimensions that matter and these are always taken by the gpu as at the next power of 2.so your background, for example will count as 512 x 256. Not a problem in itself but it may be if you have enough separate graphics. Your 30k graphics may actually be taking up more than that when decompressed and treated as a PoT. You don't mention using texture atlases but these have a great impact on performance in iOS8 if you are using webGL and will also help alleviate the memory problem.

Link to comment
Share on other sites

Oh yeah of course - the main difference with iOS8 is that WebGL is available! So your issue is more than likely due to running the game under WebGL. Try forcing canvas2D mode and see if that makes the problem go away. If so then as SpencerTL said above the crashing is likely due to something related to texture handling. 

Audio initially sprang to mind for me because that's where I'd personally encountered difficulties on iOS 8 but I was overlooking the elephant in the room...  :lol:

Link to comment
Share on other sites

I had no idea that iOS8 used WebGL... I switched to Canvas and things were a LOT better! Also, the suggestions about audio was helpful too - I took out the background looping sound and left in all the other little sound snippets, and iI was able to make it through all 23 pages of the app on my non-retina mini.

 

We're looking at optimizing the other audio and seeing if there's a way to trim memory even further... thanks for everyone's help, and if anyone has any other memory-reducing tricks that haven't been mentioned, please post them.

 

BTW: I'm using texture atlases for the animation, but not for displaying single images... would that help?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...