IPhone app shows previous state when opening - iphone

I have very weird problem. My app works cool on simulator but when installed on iphone it shows strange behavior
Suppose i was at settings page then I closed the app using home button. And then I start the app again after quite a while and I will always first get the settings page for one second and then the main loading screen. This happens for every other page even its not the settings ViewController
What is wrong?
Best Regards
Umar

Standard behavior, UI restoration. Your iOS apps picks up execution right where you left.
This means: if the app is pushed to background, a screenshot is taken. Coming back to the app, this screenshot will be shown and meanwhile your UI gets prepared.
If you have code in your app in applicationDidBecomeActive: or applicationWillEnterForeground: (see here: http://developer.apple.com/library/ios/#documentation/uikit/reference/UIApplicationDelegate_Protocol/Reference/Reference.html) and that will immediately reconfigure the UI, you get the behavior described.
You can turn OFF UI restoration and have your app really quit instead of pushing it to background by changing a key in the info.plist: UIApplicationExitsOnSuspend

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.

Strange iPhone App Launch Issue

I'm implementing secure passcode functionality within the app. Part of the solution is based on the PTPasscodeViewController sample code that can be found on GitHub. The issue I am having is when the app is first launched and the PIN is typed the UI is not updated with a circle in each box. If the 4 digits of the PIN that was entered are incorrect my message isn't displaying. It's as if the runloop isn't getting executed or something. If I enter the correct PIN the app is unlocked as expected. The functionality works but the UI isn't updated.
Once the app is unlocked if I go into Settings (in the app) and change the passcode the dots show up just fine and if during PIN confirmation the second PIN does not match the first the UI is also updated correctly.
Background multitasking is enabled in this app. On iOS 4.2.1 when the app becomes active again the same PIN validation logic is used as when the app is first launched. The only difference is it isn't really the first lauch but a return from the background. In this case, the PIN validation logic AND UI works correctly... the same code is executing. The dots and any messages are correctly displayed.
However, on 3.1.2, since background multitasking is not supported the app is always launched from scratch. So every time the app is launched the functionality works but the UI fails to update properly.
I must have a basic misunderstanding of something here but not sure what it is that I don't get. Can anyone point me in the right direction?
I resolved this issue myself and it was a result of a lack of understanding the fact that applicationDidBecomeActive also fires after applicationDidFinishLaunchingWithOptions. Basically the code to show the PIN validation screen was being executed twice in a row when lauching the app for the first time. Removing the PIN validation launch from applicationDidFinishLaunchingWithOptions and calling it only in applicationDidBecomeActive fixed it.

IPhone: Why does my app resume and not restart when I relaunch it on device?

I don't know if this is an iOS4 thing or something, but basically say I have a few screens in my app. Now, when I hit the home button and relaunch my app it launches the app on the screen where I left off. It's almost like it's not restarting my app, but resumes it. I don't want it to do that. (I'd like it to show my splash screen main menu, etc. )
Does anyone know how to resolve this? thanks
In iOS 4, apps are suspended (not terminated) when the home button is pressed. When you "relaunch" the app, it is simply moved to the foreground. If you want your app to terminate when the user presses the home button, set the value of UIApplicationExitsOnSuspend to YES in your app's Info.plist file. If you do this, when the user taps the home button the applicationWillTerminate: method of your app delegate will be called and then your application will terminate.
I think this should help you. Basically what you need to do is disable the multi-tasking features of iOS4.
http://www.iphonedevsdk.com/forum/iphone-sdk-development/60989-disable-multi-tasking-ios4-application.html
That's exactly the multi-tasking you asked about yesterday working behind the scenes. You need to opt-out if you want that behavior. See answers to your previous question here. Have you read the answers there???

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

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