how to hide splash when the app is coming back from background? - ios

I just set the 'Application does not run in background' parameter of my ios app to NO and I added the relevant refreshes in applicationDidBecomeActive: in my application delegate then it works pretty well. But when I switch back to my app, the splash screen still appear during one second. How to remove it and display directly the app ?

I though it was impossible, but it remembered me this topic : Prevent Splash Screen from showing after returning from background
It seems to include an answer to your question...
Also, don't forget to try on the device, sometimes the simulator does weird things.

Related

Launch Screen only showing once

I have used the LaunchScreen.storyboard file in my swift file to create a launch screen, however I only see the launch screen when I load the app onto my phone. After that, even when I kill the app I don't see the launchscreen again. I want it so that it shows every time the app is booted, so after it's been removed from the background like most other apps that exist. I there a setting that i need to toggle, or am I doing something wrong?
What you want can be achieved from the initial ViewController instead of Launch Screen.
Reason: Launch Screen timing is not fixed and can have a very short appearance if the app has recently been in the memory.
I would recommend you to use the welcome graphic/animation on the initial View Controller and move to the intended View Controller after a set timer by using a segue.
Edit: Additionally, in case of a graphic, you can put that on the Launch screen as well, then on the initial View Controller. That will get you continuity.
Hope this helps.

Do apps like Twitter implement custom relaunching when opened from background?

I've noticed that when I go off an app like Snapchat, Twitter etc for a few seconds then go back on it, it opens from background as expected, on to the view controller I was last on. However, if I go off the app for more than a few minutes, when I tap on the app it loads the splash screen again and opens the home page.
I initially thought this was standard iOS behaviour, but when I installed my app onto my device I have noticed that even if I go off it for hours, when I come back onto it, the last view controller I was on is shown.
I have thought about checking how long the app was in background by saving times in NSUserDefaults, but don't actually know if this is the right way of going about achieving that kind of behaviour?
Thanks!

UISplitViewController changes display mode when app suspends

I noticed some bizarre behavior in my iPad app: when the app transitions to the background, my active view controller receives viewWillAppear/viewDidAppear messages.
From my investigation, it seems this is happening because when my app moves to the background, my UISplitViewController for some reason first transitions its display mode to .PrimaryHidden and then immediately back to what it was before (.AllVisible).
Is this expected behavior? If so, why does UISplitViewController need to change its display mode (twice) when the app suspends, and is there a way to prevent it from doing so?
Edit: I just verified this behavior with a simple test app, but I'm no closer to understanding why it happens or how to prevent it.

iOS remove view before applicationWillEnterForeground

I'm developing an app on iOS 7 with a desired feature is that
When I home button, app enter background, I will add an image to current UIWindow. So when app enter background, if user double home button on iOS 7, os will show a small screenshot of current view of my app, so user can see my added image. :) (I did it)
When user return my app by clicking app icon, I want to remove this image immediately. In this situation, "immediately" means that user can NOT see this image anymore, user just see his/her current view when app enter foreground. I try to place the code remove image on the beginning of applicationWillEnterForeground delegate, but I'm still able to see this image for a short time after it disappears.
I also try to set hidden, alpha property for this imageview first, then removeFromSuperview, but it not works.
Can anyone help me to remove it "immediately" as my desire.
That is done automatically for all applications, you don't need to do anything in you code.
I don't think that you can do it faster, it depends of device performance. Sorry man.
Like other says it is really tricky how iOS handles these events. I've been researching and depends on the memory state of the device to do it faster or not. Indeed, in iPhone 4 and 4S may not show the image that you added on applicationWillEnterForeground method.
If I were you I would solve it by adding a smooth fade out animation of that image when the app becomes active again. With [UIView animateWithDuration: animations:] it could be nicely done! :)
If I find out something else I'll answer here!

Facebook Connect always returns app to splash screen on iPad only

As the title suggests, I have an app which uses Facebook connect to log users in.
On the iPhone this works fine; it switches to the Facebook app, logs in and then goes back to my app at the same place it left off.
However on an iPad (I only have an iPad 1 to hand but I'm presuming the problem is across all 3), when it returns to my app it seems to have restarted it entirely. It goes back to the splash screen, and then to the login screen. The user is stuck in an endless loop of "unsuccessfully" logging in, despite the fact that the Facebook app is logging in correctly.
Does anyone have any idea why this could be happening on the iPad but not an iPhone?
This app is actually inherited from a much older app which was iPhone only, and to simplify things it has essentially been left that way. The images etc are just scaled based on screen size, there is no differentiation in the code between iPhones and iPads other than their screen size. The facebook connect code has a "FBIsDeviceIPad" bool, but afaik that is just for setting the position and size of the popup login dialog when not using SSO.
Edit:
Further investigation suggests it could be an issue with OpenGL ES. The app crashes when sent to the background, as the OpenGl ES code carries on trying to animate etc. The facebook app momentarily puts my app into the background, ergo the app crashes and restarts.
I'll update this once I find out how to fix this, in the meantime if anyone has already dealt with this situation I would welcome any suggestions.
In your AppDelegate Class implement this code
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
{
return [facebook handleOpenURL:url];
}
For me, it was the permissions that made a difference. I had the same problem om the iPhone. and i reduced the permissions and the app stopped doing that.
Turns out it's a memory issue as noted in the question edit. Still not resolved how to get it working, but this is at least the cause of the problem.

Resources