I have created NSUserDefaults object, it will be updated with the new value whenever an even will occur.
What I want is (as per my application requirement) that object should be cleared every 7 days.
Like if 1st time that NSUserDefaults are updated today so exact after 7 days, a method should work and clear the NSUserDefaults.
So that, new values would be assigned from then on for the next 7 days.
Is it possible in objective-c?
What you can do is store an NSDate object. Then every time the application is launched (or more often) check if the time difference between then and now is 7 days.
If it is call
With your application’s bundle identifier as the parameter.
From Apple’s documentation: