Questions tagged [state-restoration]

On iOS, State Preservation and Restoration can be used to save and reload app state to make app termination appear like a temporary interruption. When an apps state is restored, the app returns the user to the last point of use so that the user can continue with whatever task was in progress.

iOS Programming Guide - State Preservation and Restoration:

The state preservation system in UIKit provides a simple but flexible infrastructure for preserving and restoring the state of your app’s view controllers and views. The job of the infrastructure is to drive the preservation and restoration processes at the appropriate times. To do that, UIKit needs help from your app. Only you understand the content of your app, and so only you can write the code needed to save and restore that content. And when you update your app’s UI, only you know how to map older preserved content to the newer objects in your interface.

126 questions
34
votes
1 answer

NSViewController User Interface State Restoration

Summary: What's the proper way to save/restore the state of an NSSearchField in my NSViewController using the built-in user interface preservation mechanism of Cocoa? Details: I'm working on my first macOS app and I'm having a little trouble with…
rmaddy
  • 298,130
  • 40
  • 468
  • 517
25
votes
6 answers

How to best handle CoreData + iOS State Restoration?

I'm trying to add iOS 6 State Restoration to an app that I'm just about finished with. It's an app where the model mostly comes from CoreData. As recommended, I'm using the "pass the baton" approach to moving managed object contexts between View…
bpapa
  • 21,107
  • 23
  • 95
  • 147
23
votes
4 answers

UI state restoration for a scene in iOS 13 while still supporting iOS 12. No storyboards

This is a little long but it's not trivial and it takes a lot to demonstrate this issue. I'm trying to figure out how to update a little sample app from iOS 12 to iOS 13. This sample app doesn't use any storyboards (other than the launch screen).…
rmaddy
  • 298,130
  • 40
  • 468
  • 517
18
votes
3 answers

UINavigationController State Restoration (without Storyboards)

I've been toying around with state restoration. In the code below, the scroll position of the UITableViewController gets restored, however, if I were to tap through into the detail view (pushing an instance of MyViewController onto the navigation…
Andy
  • 14,210
  • 4
  • 41
  • 56
16
votes
3 answers

state restoration in iOS

I am storing my application screen, so that when the application gets opened it will show the screen that was stored. The application is navigation based. I have assigned the Restoration Ids to my two view controllers in main story board. The first…
gupta
  • 403
  • 4
  • 7
13
votes
3 answers

Core Bluetooth State Preservation and Restoration Not Working, Can't relaunch app into background

I'm trying to make core bluetooth wake up the app even when it's not running. As Apple stated, "Because state preservation and restoration is built in to Core Bluetooth, your app can opt in to this feature to ask the system to preserve the state of…
13
votes
3 answers

Cryptic warning without any google results [In Simulator]

I get this warning in my iOS project: (iOS7, XCode 5 GM) Warning: Unable to create restoration in progress marker file I am working on a viewcontroller that turns all black when I get this warning on startup. Deleting the app and restarting XCode…
Evgeni Petrov
  • 1,057
  • 11
  • 27
10
votes
1 answer

State Preservation and Restoration issue in iOS using MMDrawer

I have integrated the MMDrawerController Library in an iOS application and now I have a requirement to Restore application state even though application is killed in background(Only when application is enter from foreground to background), it is…
Brjv
  • 984
  • 1
  • 8
  • 24
10
votes
1 answer

Issues with 3D Touch and state restoration

I am working on implementing state restoration into my app, however I have ran into an issue. I recently added 3D Touch support to the table view, and it worked perfectly every time except now that I have added state restoration. When the app…
user3746428
  • 10,497
  • 19
  • 72
  • 129
9
votes
1 answer

NSViewControllers and NSViews are not getting restoration API calls

in Apple's documentation they say that in case of document-based apps you should get restoration calls (restoreStateWithCoder: and encodeRestorableStateWithCoder:) to NSApplication, NSWindow, NSWindowController and then the whole responder chain…
Pavel Smejkal
  • 3,526
  • 6
  • 25
  • 44
9
votes
3 answers

Swift: get UI objects by ID?

in iOS, is it possible to assign a string ID to UI objects and then retrieve them in the code by that ID? I am looking for something similar to the Android's findViewById(id)
Daniele B
  • 16,703
  • 21
  • 96
  • 154
9
votes
0 answers

State restoration not work on iOS 8.3?

State restoration does not work well on iOS8.3, same code works well on iOS8.2. This problem can be reproduced by using apple sample code. Steps to Reproduce: Launch app and browse to second tab Kill app Launch app again Expected Results: It…
Tony Huo
  • 91
  • 1
9
votes
1 answer

Correct way to create and restore UIViewControllers during state restoration?

I'd like to do state restoration in my app that doesn't use story boards. I'm seeing my primary app ViewController instantiated twice during state restoration - how do you ensure that it's only created once? The way I understand the flow,…
Willam Hill
  • 1,532
  • 1
  • 16
  • 27
8
votes
2 answers

iOS Bluetooth State Preservation and Restoration's DUPLICATE ISSUE -25299

I am having an issue when instantiating my CBCentralManager. I get a "duplicate issue" message when monitoring it from the iOS console (it does not show in the XCode console). I've tried updating the queue name and the restoration key id without…
marcelosalloum
  • 3,172
  • 3
  • 29
  • 57
8
votes
2 answers

How to trigger Core Bluetooth state preservation and restoration

State Preservation and Restoration Because state preservation and restoration is built in to Core Bluetooth, your app can opt in to this feature to ask the system to preserve the state of your app’s central and peripheral managers and to…
mm24
  • 8,150
  • 11
  • 65
  • 159
1
2 3
8 9