Delete all my NSUserDefaults that start with a certain word

前端 未结 2 756
萌比男神i
萌比男神i 2021-01-02 17:20

Is there a way for me to \"walk\" through a list of all the NSUserDefaults in my iPhone app, and only delete certain ones?

For example, I\'d like to get

2条回答
  •  無奈伤痛
    2021-01-02 17:44

    i Got solution for this just use it where you want to remove all sessions

     NSString *appDomain = [[NSBundle mainBundle] bundleIdentifier];
    [[NSUserDefaults standardUserDefaults] removePersistentDomainForName:appDomain];
    

    it will work

提交回复
热议问题