onemillion
onemillion

Reputation: 712

Remove information stored in App Groups

I am having trouble removing information when a user logs out of my application since adding in the app group.

This is the code I am trying to use for it.

let appDomain = NSBundle.mainBundle().bundleIdentifier
let prefs = NSUserDefaults(suiteName: GlobalVars.suiteName)
prefs!.removePersistentDomainForName(appDomain!)

How ever when executed it doesn't remove any of the information from the App Group so the user remains logged in.

Any help would be appreciated thank you.

Upvotes: 1

Views: 959

Answers (1)

onemillion
onemillion

Reputation: 712

         NSUserDefaults(suiteName: GlobalVars.suiteName)!.removeObjectForKey("USERNAME")
         NSUserDefaults(suiteName: GlobalVars.suiteName)!.removeObjectForKey("ISLOGGEDIN")
         NSUserDefaults(suiteName: GlobalVars.suiteName)!.synchronize()

This solved my problem.

Upvotes: 1

Related Questions