iOS - Relevance of the clock appearing when resuming? - ios

I'm working on a long-standing, fairly-complex iOS Cocoa app, and I'm trying to fix performance when resuming from the inactive (say, locking the device). The problem appears on all versions of the iPhone (we support back to the 3G).
The steps are:
Run the app.
Lock the screen with the sleep/wake button (lock
button).
Resume the app. The app appears on the same view that it
showed before, but it's non-responsive. Also, in the OS bar, the
carrier, signal, battery, and location icons appear, but the clock
is missing.
After about a second, the clock comes back, and at about
the same time, my app is responsive.
I would say that it's an iOS thing, but most apps don't take nearly that long to come back, including to show the clock.
What is the significance of the rendering of the clock in the OS task bar when resuming from sleep? I need to know what period of time this represents (after this event/action/delegate/etc, but before another one) so I can narrow down the point of the code to examine.
When I debug with Xcode, this doesn't happen. It also doesn't happen in the simulator, ever.
Thanks!

Related

libGDX iOS home button kills the game

I'm developing a libGDX game for Android and iOS (MobiDevelop's RoboVM fork). Android works perfectly, but I have a issue on iOS. When the iPhone home button is pressed to leave the game, and I launch the game again by tapping on icon, the game does not resume from where it was paused, but instead restarts, which means the loading screen is displayed, all assets are reloaded, and the main menu appears. Like a fresh/new start of the app. I do not have any specific configuration for the iOS module in my libgdx project and am using what was pregenerated.
Is it possible to tell iOS that I do not want to kill the process? I want to switch to pause/sleeping mode only.
I found a reason of this problem. I tested it on the real device, therefore I was unable to see a logs. When I switch to simulator and look at the logs, I found a NullPointerException. This was a cause of application crash. When I fix this bug, everything works as I expected. After iPhone home button is pressed, pause() method of com.badlogic.gdx.Screen is called and after rerun the game, it continues from exactly where it stops / pauses.
I learned a lesson: make a tests on simulator at first :-)
While I am entirely unfamiliar with libGDX, I can tell you that except for a few very specific cases (VOIP etc.), you cannot control what iOS does with your app when the home button gets pressed.
Furthermore, it is the responsibility of the developer to save the app's state when the app leaves the foreground since this is not something that is or can be handled automatically in a performant way.

How can I autolock / awaken an iPad if the home button is disabled or covered?

I am building an iPad Kiosk App and my customer wants the iPad to be "locked into" the app to keep users focused :) I have found two solutions to this. One is a lovely kiosk case which covers the home button, the other is setting SBStoreDemoAppLock as outlined in http://rick-hawkins.blogspot.co.il/2012/01/turning-ipad-into-kiosk-device.html
But the customer is also worried about screen burnout (and burn in) and wants to be sure the iPad goes to sleep, or at the very least to a screen saver, when inactive. If I have disabled the home button though, I cannot let the iPad go to sleep because it cannot be woken again. Ideally touching the screen would awake the iPad and go straight back into the app.
Is there a solution that doesn't involve me creating a fake sleep feature or screen saver as part of my app?
I would not worry about "burn-in", these aren't CRTs from the 1980s. Also, it has been announced that this type of feature will be available in iOS 6.0, so you may want to wait a few months and use 6.0.

How to simulate iPhone being put to sleep in iOS simulator?

The iPhone app I'm working on seems to exhibit a bug when the phone is put to sleep in the middle of an operation. Is there any way to simulate the phone being put to sleep in the iOS simulator?
Specifically I'm referring to the user pressing the button on the top of the phone next to the headphones which immediately blanks the screen.
NOTE: The OP asked about "turning off" the phone, which is not what happens when you push the button on top. Leaving here since part of getting to the solution is figuring out what question to ask.
Yep. In the menu bar when you've got the iOS Simulator open, Click Hardware -> Lock.
Note that this looks slightly different than actually sleeping the phone (it keeps the "slide to unlock" screen running), but achieves the same effect.
You can also do other nifty things like rotate the device and hit the home button.
To be clear, hitting the home button on the top of the phone doesn't turn it off. It just puts it to sleep.
When possible, you should always test your app on an actual device. The simulator does not simulate all of the complex OS-level stuff that goes on behind the scenes for background apps and the WatchDog process and that sort of thing.
As of 2021 to lock the simulator's screen:
Device -> Lock
or
Cmd + L

GPS arrow could not disappear at iPhone's status bar in our released app version

We developed an app which uses the GPS service of iOS 4.0+.
Once you leave our app, such as when you return to the iPhone home screen or shift to other app, the GPS would be updated in every 10 mins at background for our app.
In our development phase, the GPS arrow would disappear just after leaving our app,
but what we are encountering now is that in the release version(downloaded from AppStore), the arrow is always showing in the status bar!
So, the battery cost is more than we expected.
What is the problem?
Replied by Apple tech center:
This is not possible. Your app can use Region Monitoring to be "woken up" when a user enters or leads an area http://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/LocationAwarenessPG/CoreLocation/CoreLocation.html#//apple_ref/doc/uid/TP40009497-CH2-SW13.
Or it can declare itself a navigation app, and keep the GPS radio turned on the entire time.
This is what an app giving turn-by-turn driving directions would do. However this drains a lot of power.

How to programmatically wake an external screen attached to an iPad

I'm developing a standalone kiosk that is composed of an iPad 2, and an external screen. I have the two connected by cable, and the iPad is locked in a special case to prevent it from disappearing. This case makes the access to the connector impossible.
The problem I have is that when the iPad wakes from sleep (user interaction) the screen often doesn't wake up. Once the screen awake however, there is never a problem of it going to sleep by itself (this rules out a physical connection problem). I manage to wake up screen after several tries of switching on/off the monitor or letting the ipad fall a sleep and then waking it up.
My guess is that the iPad fails to send the signal while the monitor is scanning for it. However, after several tries I get them both to do their things at the right time, and that is when it all starts to work.
Hence the question. Can I programmatically make the ipad scan (send signal to) the external monitor? Ideally I would do it from the app I'm developing, but a standalone app could solve a trick too.
I've looked through the UIScreen Class reference and googled quite a bit, but so far to no avail.

Resources