1

This warning message happens on both iOS 8 and 9 devices as well as simulator:

[Warning: Unable to create restoration in progress marker file]

It only shows once when I first launch (With first installation) the app. Any subsequent launch of this app from Xcode without uninstalling it will NOT show this warning message.

Is this normal for my app? This is what I did to my code:

AppDelegate.swift:

import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?


    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        // Override point for customization after application launch.
        return true
    }

    func application(application: UIApplication, willFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool {
        return true
    }

    func application(application: UIApplication, shouldSaveApplicationState coder:NSCoder) -> Bool{
        return true;
    }

    func application(application: UIApplication, shouldRestoreApplicationState coder:NSCoder) -> Bool{
        return true;
    }
}

The Restoration ID is purely done in Main.storyboard, such that RestorationID and StoryboardID are the same. And also, only top level of View has the same RestorationID as the StoryboardID.

In the default created tabbed view application, I applied the following onto both my controllers (With the second controller named as "SecondView" instead)

StoryboardID and RestorationID are the same

Top View has the RestorationID same as the StoryboardID

Meanwhile, what will happen if I simply set the following functions as false:

func application(application: UIApplication, shouldSaveApplicationState coder:NSCoder) -> Bool{
        return true;
    }

    func application(application: UIApplication, shouldRestoreApplicationState coder:NSCoder) -> Bool{
        return true;
    }

Will my application still work even when it requires extended period of time in lock screen or background?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Samuel Lee
  • 19
  • 1
  • 7

1 Answers1

6

FYI. this fixed my problem: https://stackoverflow.com/a/20157399/49748

If this warning still occurred, you could check how you run your app in Xcode. I ran my app in Xcode simulator and had to follow a specific sequence to trigger state preservation.

  • launch the app in Xcode simulator

  • In Xcode simulator, click the "Home" button to put the app into the background. The encodeRestorableStateWithCoder method of the view controller should be called

  • go back to Xcode, click the "stop" button to terminate the simulation

  • In Xcode simulator, double click the "Home" button and then remove the app from the app switcher and

  • go back to Xcode, run the app again.

Community
  • 1
  • 1
Kenyth
  • 118
  • 1
  • 8