Neal
Neal

Reputation: 304

How to store array in local file in ios?

I am building an iOS app using storyboards.I am sending login profile information to server and getting response from the server as a user id i want to save this id in my local file and use in my project in different classes.

I'm unable to do this could someone help me how i can do this.

Upvotes: 0

Views: 332

Answers (1)

Michael Voznesensky
Michael Voznesensky

Reputation: 1618

Login data should not be stored in files or userdefault. I suggest storing it in an NSKeychain.

Additionally, if you need to keep it for local reference in current project scope, make a class that manages these properties and use dependency injection to pass around the class holding the properties.

check out the nsuserdefault docs for cases of when to use / not use them.

https://developer.apple.com/library/ios/documentation/cocoa/reference/Foundation/Classes/NSUserDefaults_Class/index.html

Upvotes: 1

Related Questions