Breaking News
Home / iOS / iOS Snippets / How to print values in NSUserDefaults to the NSLog?

How to print values in NSUserDefaults to the NSLog?

Solution

NSUserDefaults is basically kind of hashmap(dictionary) that stores the keys and values.

In order to print all the keys do the follow:
NSLog(@”%@”, [[[NSUserDefaults standardUserDefaults] dictionaryRepresentation] allKeys]);

In order to print both the keys & values do the follow:
NSLog(@”%@”, [[NSUserDefaults standardUserDefaults] dictionaryRepresentation]);

[pb_builder]

Check Also

EKCalendar – That account does not allow calendars to be added or removed

Usecase When I am trying to create a new Calendar programmatically using the EventKit API …

Advertisment ad adsense adlogger