iPhone: quickly quitting an app then relaunching briefly shows last screen then black, then starts fresh - iphone

Trying to finish up an app I've been developing and have hit an odd bug that I'm not sure if it's on my end? a bug on apple's end? or perhaps the underpinnings of multitasking showing themselves.
My current app is doing this weird thing when you press the home button to quit the app, and then immediately relaunch the app. You see the Default.png image as the app starts up, but when it goes to display the window/view it briefly shows the screen as it was just before you quit the app, then goes to black for about 2 seconds and then displays the correct screen as if you were starting up fresh. I'm see this on all devices, iPods, iPhones, and iPad.
This is not just me, however, I've been trying other apps to see if they do it, and have found that the Air Hockey ( http://itunes.apple.com/us/app/air-hockey/id286106725?mt=8 ) is an example of an app that does this same thing. My instinct is that there are many apps that do. But the bulk of apps dont seem to have this issue.
I've done everything I can do make sure all views and view controllers are properly released, but it's almost like the device is taking a while to truly shut down even though the app has visually disappeared, and if you restart the app within probably 3 seconds or less then it still has something in the window buffer, or tht the full on view controller hasn't truly been released yet.
Anybody seen something like this and been able to solve it?

I'm the dev of that Air Hockey - It looks like it's probably Flurry that's causing it. I have a version without Flurry & it doesn't do it.

I solved this problem by updating my Flurry files to the latest version. http://dev.flurry.com/iphone_uploadNewVersion.do

Related

iOS7 - App causes device (not app) to crash

Our company has an app which is basically an eBook reader.
We use the RMSDK to perform book downloads & read.
Now, something very strange is happening in iOS7 devices (not in the simulator):
I download a book using the fulfillment method in the RMSDK
I wait for the book to finish downloading. The book is saved in the NSCachesDirectory (for App Store guidelines reasons) - so far, everything works fine
I hit the home button, the app moves to the background
I hit the app button to bring the app back, that's when the problem happens:
The app gets completely stuck. Hitting the home button does nothing, hitting the power button shuts down the screen, but then hitting the power button again does nothing.
The device itself has effectively crashed.
After a few minutes, the Apple logo appears on the device and the device comes back to life after a reboot.
I have no idea what in my code could be causing the device to act this way. Shouldn't the iOS7 sandbox prevent me from being able to crash the whole device?
Any ideas on why this could be happening and what I can do to prevent it would be greatly appreciated.
EDIT:
I placed a breakpoint on the -(void)applicationDidBecomeAcvive: method in the AppDelegate, and it's not being called when clicking on the app icon in the last phase before the crash.
EDIT:
The RMSDK is using libcurl to download the books. Could this be a cause for this behavior?
EDIT:
The problem is happening if I click on ANY app after I click on the home button, not just on the same app. So for example, I click on the home button, then I try to open Fruit Ninja, and the device crashes.
We managed to solve this issue by disabling functions in RMSDK, which call mkfifo(). I'm not sure how much I can say here due to NDA but they're all located in one file and can be cleanly converted to no-ops with a nice preprocessor #if defined()
Its an OS level bug. iOS 7 is still unstable in areas, for example my Apps report crashes in places that are part of iOS 7 itself and couldn't be caused by my app.

How to relaunch an Air-based iOS application from the very first page?

My application is an Air-based iPhone app. It opens with the last page I visited before clicking the Home button, each time I relaunch the app, while I need to open with the splash screen onward. How can I resolve this issue?
Thank you for any help.
When you press the Home button, you don't terminate a running app. I'm sure that many of us developers have stuck with this mental model of how iOS used to work without multitasking.
So, the splash screen, or rather, the default image (Default.png) should really appear once (when your application launches). Some times, the default image appears when coming out from the background state, but this happens only if your app takes too long to show its UI. In fact, on fast iPhones, the default image disappears almost instantly even on launch (for well-written apps, that is).
I should also note that Apple actively discourages the use of the default image for splash screens. These should only be used for creating an illusion of transition, from a "launching state" (which the default image is supposed to portray), to the running state.
However, if you really have to show a splash screen every time, you should implement such a mechanism in code. applicationDidBecomeActive: is a good place to start, if you are writing code in Objective-C.
I don't know the event model in Air, so I can't really give you any hints for that.
The above answer, though old, does not answer the question. Sure, Apple gives guidelines regarding splash screen and all, but the poster asks how to prevent the app from resuming from it's previous position. If you want the app to terminate when put in the background you need to look into the UIApplicationExitsOnSuspend option. There's also an Adobe blog post explaining a bit more about different background behaviors.

Very strange iPhone app crash problem with tabbar based app

I know the title sounds a bit awkward but let me explain my problem.
I have a tab bar based iPhone app which works perfectly so far. I can switch through the tabs and every tab loads a view controller.
But here is how it crashes. After I used the app and working with a bunch of other apps I switch back to my app (for example after one hour). The app shows the screen where I left it. Now when I try to change the tab, it crashes immediately.
The problem is that I can't reproduce this crash in the simulator or in the debug mode. I tried to open it, then close it, then reopen it but then everything works. Only after a certain amount of time the crash can be reproduced. But I don't have any logs.
Maybe anyone had the same the problem and knows what to do here?
Could it be related to low memory (i.e., you have a bug that only shows up during low memory)? Have you tried "Simulate Memory Warning" in the simulator?
Connect your device with system using iPhone utility and found the reason for crash. It may be memory problem only.

iPhone - fast-app switching and iOS 4

I'm trying to get the following functionality in my iPhone app:
When backgrounded, stays running (doesn't have to do any background work)
When resumed, app picks up where it was left off
I'm mainly wanting the same screen on my app still up, as there are several UINavigationControllers within a UITabBarController.
I have done all of the following:
Made sure I'm compiling with 4.1 SDK
Set UIApplicationExitsOnSuspend to false
Handle DidEnterBackground and WillEnterForeground in my AppDelegate
Call BeginBackgroundTask in DidEnterBackground, to attempt to keep my app open
I'm using MonoTouch, but that it probably beside the point. I can take answers in Obj-C, for sure.
I've tested my app on a jailbroken phone with Backgrounder, and I see the "app in background" badge disappear immediately after pushing the home button. I also tried setting UIBackgroundModes in my Info.plist, but to no avail.
Is there anything I'm missing?
Or is this something I would have to implement on my own to resume the previous state of my app? Everywhere I've read talks like it should just work automatically.
If you don't want to be doing work in background, don't call beginBackgroundTask. That call is for situations where you want to do some kind of work in the background. And if you don't finish that work fast enough, iOS will terminate your app.
When I upgraded to iOS 4.x, my MT application started exhibiting this behavior without me having to do anything. iOS should take care of it for you.
I finally got in touch with someone on MonoTouch's irc.
In MonoDevelop there is an option to make a dual iPad/iPhone project, which I used. This is causing my app to behave as if it's running with the 3.2 SDK when deployed to the device.
I think my solution is to install the iOS 4.2 SDK that just came out, since this ads the new multi-tasking feature on iPad.
Not only do you need to support going into the background, you also need to support cases where your app has been terminated. In your app’s initialization code, you should resume the state that it was in. For instance, when you push a view controller, use NSUserDefaults to store a value for the currently-displayed screen, and then when you start read that value and display the associated screen.

Default.png problem with iPhone OS 4?

What should Default.png contain? Currently it seems that iPhone OS makes snapshots of the screen before closing the app, and next time it launches with that exact snapshot as "splash screen image".
A guy here in Russia told me that this is only happening when Multitasking works on the device.
What would I show in Default.png now? I don't want that the app launch sucks for users without multitasking, and I don't want it to suck for users with multitasking where the app had to hardcore-launch anyways (i.e. first launch at all). So what would that contain? A screenshot of the app screen how it looks after a hard launch from scratch? But what if my app is clever and saved state, and the UI looks completely different after launch?
What are you guys putting in Default.png and why?
If fast-app switching is working on the app as part of multi-tasking, you are correct in stating that the OS will take a snapshot and restore your app to this state after it comes out of the background. If the OS is saving state for you, then coming out of the background doesn't "suck" since it brings you app back into view looking just like it did when it left. It's almost like minimizing a window on Mac OSX and then maximizing it again... you just pick up from where you left off before.
Be advised though that the app could get killed at anytime in the background without warning or notifications being sent to you. In that case, you should still save state and try to create a splash screen that works with all of your views (i.e. has a tab bar at the bottom, or a nav bar at the top, etc). If you can't do that, you might consider just doing what Jesse has done with a company or app splash screen (even though Apple doesn't endorse this, but they won't reject you for it either).
As Jesse stated, Apple recommends creating an outline of the main elements to familiarize the user with your app and to give the appearance of faster loading. More information is here
For iPhone splash screens I am still using a company logo splash. for iPad, a basic "outline" of what the screen i am coming into will look like (a splitview basically, depending on orientation). The fact that default.png isn't editable does make this tricky though.