I have looked into a few posts and saw some related posts on it but I still don’t get it.
My app is a rating system. I want to store which posts the user rated so he/she can’t rate again. Each post has an ID. How should I go about this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If the rating is happening locally, you should look into CoreData to store your Post objects along with the user rating. You could then query the store using the post id to see whether it’s been rated already.
A more lightweight approach (although I wouldn’t recommend it) would be to save the rating directly to NSUserDefaults using a unique key, containing the post id. For example:
To know whether the user has already rated a post, you would do so with: