Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8272107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:01:39+00:00 2026-06-08T07:01:39+00:00

I hope this question isn’t too general/ambiguous… I’m writing an iphone quiz game app

  • 0

I hope this question isn’t too general/ambiguous…

I’m writing an iphone quiz game app and am having trouble figuring out the best way to handle data. Currently I am thinking of having a single Model class that holds an array of “User” classes which each have an array of user-specific “Question” classes. I’d like to be able to access the overarching Model from any of my view controllers, but that means I’ll probably have to pass the model object to any new view controller, use a singleton, or do something else. What is the best way to access my Model object from other classes? Another factor I’m not sure about is being able to save the data – would I have to use Core Data/SQLite to save my single Model object, or is there a simpler way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T07:01:40+00:00Added an answer on June 8, 2026 at 7:01 am

    I’d start by designing a schema using CoreData. IMO, its best to start out using CoreData because then you’ll never have to convert your data layer to CoreData, in the event that your app scales beyond a simple object or two.

    The other route would be to create a web service that returns your data… so you just call the service and it returns a collection of user objects. You can either send down the entire object graph with the questions, or create another service to return a collection of questions for a specific user. If you have a web server handy, this method scales the best because you don’t have to rely on app updates to get new questions into your system. I would still use CoreData to cache the results… so that way you’re not downloading the same information all the time.

    So when it comes to accessing CoreData objects, I use a repository class that’s a singleton. This makes it easy for any view controller to grab an instance of the repository and get some data. Here’s what something like that might look like;

    [[Repository defaultRepository] findFirst:[User class] 
                                               where:@"name == 'John'"]
    

    There’s a lot of redundant code to fetch data so wrapping that up in an object will help get all that nasty code, like predicates and sorting, out of your view controllers. You can see where I leverage a va_list in the where clause so I can inject that string right into my predicate. Here are some other methods you could implement:

    - (NSArray *) findAll:(Class)entity 
                sortByKey:(NSString *)key
                ascending:(BOOL)ascending;
    
    - (NSArray *) findAll:(Class)entity 
                sortByKey:(NSString *)key 
                ascending:(BOOL)ascending
                    where:(NSString *)format, ...;
    
    - (id) findFirst:(Class)entity 
               where:(NSString *)format, ...;
    

    I’m not sure if this is the preferred way, but I’ve had a lot of success with this method. Hope this helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I hope this question isn't too general. Well, the situation is that I am
I hope this question isn't too dumb. We have many websites internally that need
I hope this question isn't too open ended, but a nudge in the right
Alright, I hope this isn't too broad a question but my curiosity got the
Hey guys, hope this isn't too much of a n00b question I'm mainly a
I hope this question isn't too simple, I tried to go through the postgresql
I hope this isn't too vague a question, but here goes. I want to
Sorry, still reasonably new to Javascript here, so hope this question isn't too embarrassingly
I am new to .NET in general, so I hope this isn't too n00b
I'm new to Windows Phone 7 App Programming, so I hope this question isn't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.