1

I've implemented a REST API Webservice and my iOS app creates requests to this webservice like a registration of an user. The REST webservice responses the user id if successful. A typical login is not a part of a REST webservice. Now I want to save this user id on the iPhone for this app, so I don't have to login everytime on starting the app. But how is it possible. How should I do this with swift? And what is the typical way to do this in an iPhone app?

Thanks!

GRme
  • 2,707
  • 5
  • 26
  • 49
  • You might want to check the [documentation for NSUserDefaults](https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSUserDefaults_Class/Reference/Reference.html) – zisoft Sep 25 '14 at 19:05

1 Answers1

0

Is the "user id" you want to save need to be secret? If not that actually might be a good candidate for NSUserDefaults. If is needs to be secret use the Keychain.

For an example of using the Keychain from Swift see this: SO Answer

Community
  • 1
  • 1
zaph
  • 111,848
  • 21
  • 189
  • 228