How to temporarily change all default user settings without destroying the original?

Posted by mystify on Stack Overflow See other posts from Stack Overflow or by mystify
Published on 2010-05-25T12:30:08Z Indexed on 2010/05/25 12:31 UTC
Read the original article Hit count: 174

Filed under:
|

My app is based strongly on a lot of NSUserDefault keys and values.

I want to implement a temporary defaults profile which the user can activate to get a special task done easily. For this, some of the user defaults must be changed temporarily so the app adjusts it's interface appropriately.

I started to just manually change those NSUserDefaults settings, but this also destroys the user's original settings.

Is it possible to keep a backup of the user's NSUserDefault settings and restore them after the user quits the temporary mode or the app?

Like I see it, NSUserDefaults actually is just an NSMutableDictionary which is generated out of a plist file. So I would just make a deep copy of that and later assign that copy somehow back to NSUserDefaults?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about nsuserdefaults