2

I have a fully implemented iOS App consisting of several view controllers.

Some of the view controllers are subclasses of e.g. UIViewController or UITableViewController, but some of them just use the original class directly, such as UINavigationController.

Is there any way to get or generate a unique identifier for each instance, so I can reference to the same specific controller next time the app is opened?

CodeMonkey
  • 114
  • 1
  • 7
  • Check this SO post out http://stackoverflow.com/questions/11744106/how-to-assign-an-identifier-to-a-uiviewcontroller-from-the-mainstoryboard – Anil Jun 09 '13 at 04:31

1 Answers1

0

In the storyboard go to the view controller you want to set the ID for. Press the identity inspector (the button third over or index 2 if it were an array of icons starting from 0;)). You will see "storyboard ID" you can set the unique identifier there.

Here is a post that explains how to use the storyboard ID In order to instantiate an instance of that story board object in any other class.

What is a StoryBoard ID and how can i use this?

Community
  • 1
  • 1
AdamG
  • 3,718
  • 2
  • 18
  • 28
  • I need to be able to get an unique identifier without setting it first. It is for a library that injects into an existing project. – CodeMonkey Jun 09 '13 at 04:35
  • Why don't you set the unique identifier when you inject into the existing project? – AdamG Jun 09 '13 at 04:36
  • The identifier needs to be consistent across all installations of the app. I was contemplating generating some kind of checksum based on various attributes? – CodeMonkey Jun 09 '13 at 04:38
  • I knew I should have my name copy writhed ? :) – Adrian P Jun 09 '13 at 05:05
  • @CodeMonkey .. Did you get a solution for this. "I need to be able to get an unique identifier without setting it first. It is for a library that injects into an existing project" ... I am having the same requirement – Aravind G S Mar 23 '17 at 13:55