I'm writing an alarm clock app, with a special twist to it. Not going to get into detail. Anyways, I'm trying to think of the best way to save the alarms.
I figured, since its a pretty basic app, it wouldn't require core data. So I was going to save them under NSUserDefaults
. I used NSCoding
to encode the objects, but I can't for the life of me figure out which key to use when saving them. Originally, I was going to use a key for each one. But that would involve searching NSUserDefaults
keys for any that start with x (memory heavy). Also I'd have to find an efficient method to increment the key and circle back around when a key is deleted.
So then I tried adding the alarms to a dictionary (I tried an array, too) and adding THAT object to NSUserDefaults
. To no avail.
Can somebody help me figure out the best way to do this? If it has to be core data, so be it. I just figured it was overkill for something as simple as adding alarm instances. Shooting for user defaults.