Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Background

I am dynamically building an FQL query statement and because of the nature of the app, I exclude FB family members, this is the base portion of the query and remains fairly static. The query returns the FB profile pic and I display it on the UI.

However, after the FB friends are displayed on the UI, I want to give the user the option to select a returned FB friend to never be returned in future queries and to return a new user in that users place

Currently I am storing the other returned member uid's as a temporary exclusion in a Mutable Array, to prevent duplicate members being on the screen at once, I am also storing the excluded member in a different mutable array.

I then build the query statement dynamically inserting the exclusion of all of the uids in the temp array and in the excluded array and then I dump the temp array after I return a new user in the place of who they picked to exclude.

Questions

What are some recommendations on the following:

  1. storing these excluded uids(strings) during the apps lifetime? resort to a persistent storage method(core data/sqlite) or store in an array that is a part of a user object (NSUSer Defaults seems like a bad choice as this list can potentially be very long)

  2. What are recommendations on some persistent storage so that exclusions can be taken into a query statement after the app is shutdown and started up (core data/sqlite/nsuserdefaults seem to be the only options here, userdefaults seems to be the least favorable because the reason mentioned above)

  3. What are recommendations on injecting these unknown amount of uids(strings) into an FQL query statement which will be a string itself?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Best will be to store all your FQL objects to Core Data and filter them with some property, like this.

 typedef enum {
     kFamily = 0,
     kActiveFriend = 1,
     kNonActiveFriend = -1
    } TypeCheck;

    @interface CoreDataFQLObject : NSManagedObject
    @property (nonatomic, retain) NSNumber *checkType;
    @end

A hint enum is a integer in Core Data. You need to prevent non friend user to appear on new log in account. For that you can delete .sqlite file and recreate again when user is try to login with another account credential. Or you can make a Core Data scheme with one to many rule for user who was just logged in "me()". Do not forget to check for duplication on insert operation.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.