Have been having a problem for the past week or so. My app runs as expected in the simulator, but when I try to send it to the phone or iPad, I get only a black screen. xCode doesn't report any problems. Juce Demo appears to be fine with the latest updates.
Any suggestions of what I might have screwed up or where to look? This did start happening after I pulled the latest Juce last week, but since the demo is fine, I'm scratching my head.
*crickets* ... yeah I guess that was a pretty open ended call for help :)
the eventual solution I found to this problem was to replace a HighResolutionTimer I was using with a regular Timer. For whatever reason the Juce hi res timer is not working correctly on iOS on devices (works fine in simulator). I tried using it in another spot in my app, and it resulted in the timer not running, but otherwise no problems like the black screen mentioned before.
For funsies I replaced the timer in the Juce Demo timers and events page with a high res timer. The timer will run in the simulator but not on a device.
Well, there's a bunch of android-specific code in the high-res timer, so I'm guessing it must have worked correctly when I wrote it! It'll be quite time-consuming to debug this, and I don't have time to look at it right now, but will do so when I get chance.
Ok, just tested HighResolutionTimer on my android device and it runs just fine.
You realise that the callback happens in a background thread, right? You can't just replace a regular Timer with a high res one unless your callback code is thread-safe..
well I think what I'm doing is thread safe within the callback. It appears that the callback never gets called at all actually. Again, fine in the simulator, but on the iPad or iPhone it doesn't work.
Is there some other way I might be misusing the timer? Let's take the Juce Demo as an example. If you replace the timer in the timers and messages page with a high res timer, should it run?
ok, bad example. all i really need to do with the callback is send a message. If all I do in the callback is write hello world to the console that doesn’t work for me on an iOS device, but it works elsewhere.
The problems I've seen might be related to starting or stopping the timer. The black screen at launch happened when I was stopping the timer (stupidly) before it was even started. But regardless, the timer callback is not ever getting called after the timer starts as far as I can see.
If there's any specific test you want me to try here just let me know.
Well it's only a very small piece of code - in juce_posix_SharedCode.h, line 1220. The code looks completely fine to me and is the same on OSX and the simulator, so I've no idea what's going on. The thing to do would just be to see what happens in that Clock class, and look for anything strange.
The android code performance is bad and the iOS timer works, but is very very to slow!
I have changed the millis multiplier from 1000000.0 to 575.0 and then it works on the phys device. That's going on?
(I don't know the right multiplyer, but about 575 looks ok and my clock is working well)
I have tested this on iPad2. I have also an iPad3 here but not tested jet. Can anybody test this on iPhone and iPad4??