iPhone App in suspended state, launched by URL, showing Default.png - iphone

The app responds to a custom URL, and correctly launches when in a suspended state. The question is, can I disable showing the Default.png when launched this way?
A use case for clarity:
app is started normally
a home button press puts app in standby
a url of the scheme the app recognizes is tapped in mobile safari
users sees Default.png before launch is complete.
As you probably know, when fast app switching activates usually the app is redisplayed with a screenshot of the last state rather than the Default.png. This is what I'd prefer happens when the URL launch takes place also.

It sounds like what is going on is that Fast App Switching is not actually working. So:
Make sure you are building the application for SDK for OS 4.0. If you don't, you app will not have fast app switching support.
See if fast app switching normally (otherwise) works with your application. I.E. when you just switch to safari, then re-launch your application, do you get the "default.png"?
Run the app under the debugger, but on your actual device. Make the problem happen, go into the Organizer, and look under device logs. This will show you if there was a low-memory issue which caused your application to be terminated, when Safari was launched, thus requiring it to be re-launched when the URL was selected.
I believe there were two mechanisms in place. In my app, I do not support "Launch with URL" - but what I do do is support the Application Delegate's call:
-(BOOL) application:(UIApplication *) application handleOpenURL:(NSURL *) url {
This may be the difference - this is the call which can be made to an application that is running to hand it a URL to process. If you are using the other technique, use this one instead. I use this, and do not see the "default.png" - i.e. do not evoke a "clean relaunch" when I get called.

Here's a possible workaround. This was causing me a headache with trying to seamlessly return from Facebook's single sign on process. I wanted the appearance of going back to my app's login area, instead of the appearance of restarting the app, even though I verified in every way possible that the app was indeed returning from fast app switching and not actually restarting.
While I couldn't find any way to force the app to display the previous state's screenshot, I did discover that the app will display Default-scheme.png (for example, Default-fb12345.png or Default-appname.png) when invoked with a url. So if your post-app switching screenshot is fairly predictable, grab a screenshot from iOS Simulator and copy it into your app. I would consider this an iOS bug. The app should always display the last screenshot when app switching, rather than Default-scheme.png simply because a url is involved.
Another possibility, which I didn't test, would be to symlink the bundle's Default-scheme.png (and Default-scheme#2x.png) to the snapshot file in the app home directory. This would be Library/Caches/Snapshots/[Bundle identifier]/UIApplicationAutomaticSnapshotDefault-Portrait#2x.jpg for most situations (unless it's landscape, or an iPad). If your app's state is unpredictable but the orientation is fixed, this could be a good option to try.

Make sure you've got the "Required Background Modes" key set in the Info.plist to the function that the app needs. If it's not listed, I just use "App Plays Audio" to keep it open.

Related

LaunchScreen storyboard is it mandatory for App Store app

I coded my app with several ViewControllers including an initial WelcomeVC. My app works well and I have no delay when launching it. I have seen that LaunchScreen.storyboard is used for first screen when app is launched but I don't need it in my app. I want to use it and submit it this way to the App Store without LaunchScreen. Do you know if this is possible?
Nevertheless I tried to add a simple LaunchScreen but I see no utility as on my Iphone when the App starts it goes so quick that I don't see the LaunchScreen.
Can I post an app without LaunchScreen?
Can I post an app without LaunchScreen?
No. Well, you can post it, but it will be rejected.
The launch screen does more than just provide an interim screen during launch. It also acts as a signal so that the device knows your app can adapt to it. Therefore Apple now requires (or soon will require) that an app submitted to the app store have a launch screen.

Mac app disappears when window is closed then another app is selected

I created a new macOS project in Xcode 11.4 where the language is Swift and user interface is SwiftUI. Without making any changes to the code in the project, the app will disappear from the dock by performing the following steps:
launch the Mac app by running the Xcode project
close the main window of the Mac app
select another running app such as Safari
the original Mac app disappears from the dock with no way to access it
This behavior does not happen if the window of the Mac app is open. I can select other running apps then go back to the original Mac app with no problems.
This behavior is known as Automatic Termination. I find it a misfeature, but Apple considers it a feature.
Your app may not have actually quit. It may just appear to have quit. "Launching" it again will just make it reappear in the Dock. It's also possible that some apps which look like they're still running have actually been terminated by the system. In theory, if you try to switch to them, they will be launched and told to restore their previous state to maintain the illusion that they were running all along. In practice, apps (even Apple's) rarely properly restore things to exactly how they were.
The process list in Activity Monitor is a true reflection for what is and is not actually running. Look there to determine if your app has really been terminated.
A developer is supposed to have to opt-in to Automatic Termination because it requires explicit coding of state restoration. However, Xcode's app project/target templates have it enabled by default. You can remove the NSSupportsAutomaticTermination key from your Info.plist to disable it.
Likewise, you'll presumably want to disable Sudden Termination, too, if you're not prepared to support it. You would remove the NSSupportsSuddenTermination key.

Access the Apps available in iphone

Hi i would like to access the apps which are available in iphone means downloaded apps and inbuild apps.But here issue is if i access any app which is available in iphone using [[UIapplication sharedapplication]openurl:[NSURl url urlwithstring:#"http://www.skype.com"]] like this i can able to access that iphone app succesfully but if i want to come back to my app i did not find any way only i have to hit homebutton. So is there anyway to come back to my app at any point of time. if anyone know please let me know. Thanking you.
So is there anyway to come back to my app at any point of time.
Not unless the other app supports returning back to the calling app (by responding to a special specifier in the URL, for example).
Note that there is also -[UIApplication canOpenURL:] which will tell you if a particular URL scheme is supported. This is useful to check whether a particular app is installed without attempting to launch it.
That is default behavior of the iOS application. Once your application is in background there is no way to come back to your application programatically.
User has to manually open your application.
You can navigate to some other apps on the phone using the URL method, however you cannot return to your app.
Once you navigate to the other app, it takes over and your app is no longer running. Therefore, the other app would need to navigate back to you. That obviously is not possible, unless you had access to the code of the other app.

How to reboot or reload iPhone app programmatically in iOS

I have dowloaded an xml file that contains some update parameters and then I need to reload these parameters and init some views. Easiest way is to apply this configuration on next app boot. Is there any way to reboot iOS application programmatically?
Thank you.
Rebooting the app is a bad idea, I'm pretty sure Apple would reject it. However, You could display a popup telling the user to open a close the app to apply your updated information. But the best way would be just to manually call the methods needed to rebuild your app (I.e. the ones that need to use the updated data).
If you have to do some extensive rebuilding (i.e. things that the user would immediately notice) it might be a good idea to add in a "loading" progress bar of sorts.
You can't reboot your app, and I don't see why you would a) have to b) EVER WANT TO.
You can quit and restart an iOS app with a bit of user assistance. Set the app's plist key for application exits on suspend. Create a local notification for your app to trigger a few seconds into the future. Then send Safari a URL. The OS will terminate your app when launching Safari to handle the URL. The URL might be to a web landing page telling the user that a relaunch is in progress. Then the local notification will go off and ask the user to relaunch your app.
However an app should be (re)designed so that there is never a reason to do this.
You can do it only if your device is jailbroken
Put a reboot button in your app and call abort();. This will crash the app.
Hook the -(void)exitedAbnormally; from SBApplication and write code to launch your app.
If its not jailbroken, you have no choice
if you develop for jailbroken devices you can use uicache command to clean the springboard cache and reload new apps/icons (available from UIKit package).
for example,
1) if you're under root:
su mobile -c uicache 1>/dev/null 2>&1
2) if you're under mobile:
uicache
for reboot you can use rebootcommand under root and killall SpringBoard for respring

iPhone 4.3.3 shows wrong(depreciated) 'zoom-in' snapshot(screenshot) at launch

It's hard to describe my iPhone's situation..
I launched an App and used it. for example, a Twitter app.
After that I closed it with Home Button.
Then I launched a few apps which were enough to take most memory.
And, when I launch the Twitter app again, a screenshot(snapshot), which was taken exactly when I closed the app at first, was shown about 0.5~1 sec.
I know this is a way of animation effect, but mine is somewhat wrong,
because that screenshot should be 'loading image (ex: Default.png)' if the app launched long time ago is about to start from the beginning (the 'twitter' app must be closed because of out of memory).
It makes stressful situation when I use kind of 'personal memo app'.
Before I upgrade to iOS 4.3.3, whenever I launch this app, it requires password without showing any old screenshot.
But now, everyone can see my memo because of that automatic snapshot which pops up about a second.
Help needed. Thanks!
Before your app goes into background you need to hide/remove all the views you don't want to appear when you open the app again.
You should do this in the applicationDidEnterBackground: UIApplicationDelegate method.
See the Remove sensitive information from views before moving to the background bullet point in this section of the Apple Developer Docs.
The only way I know to prevent that is to set "Application does not run in background" in your plist file.