views:

78

answers:

2

I have the music player application in which I have 90 songs total. I would like for the user to be able to listen to three of these without logging in, then require them to log in to listen to any others.

How would you suggest I implement this?

A: 

Store how many songs the user has played in some sort of data structure that is persistent like CoreData. Look into the apple tutorial on core data for ideas. There are many examples with sample code. If he listens to 3 songs then prompt him to the in app purchase for the upgraded version of your application. The only way around this would be for the user to unistall and install the application.

That method is assuming you don't want to setup a server and log people's device id's

Edit: If you don't want to use core data then you can make sure your objects conform to the NSCoding protocol declared Here.

IphoneDev
I don't want to use core data function or (in app purchase ) in my app
Then use `NSCoding`.
tob
A: 

Why don't you just store the count in a NSUserDefaults key.

Elfred