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 8118893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:38:10+00:00 2026-06-06T04:38:10+00:00

I am a little confused on the proper way to implement an NSObject model.

  • 0

I am a little confused on the proper way to implement an NSObject model. I am creating a Book class that will story some data (NSString, UIImage, etc.) but I am storing the data on a server. Should I create a method for Book like -(void)loadDataFromServerWithID:(NSString *)bookID then when I create a Book like this:

Book *book = [Book alloc] init];
[book loadDataFromServerWithID:@"1234"];

and within the loadDataFromServer method download the JSON data and assign the instance variables to the object?

I’ve been thinking of many ways I can do this but I’m not really sure anyway is efficient/smart way to do it.

Thanks for any help.

  • 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-06T04:38:13+00:00Added an answer on June 6, 2026 at 4:38 am

    One way to do this is to have only 1 class responsible for talking to the server, then have a method in the class called something like bookFromServerWithID: that returns a new book object ready to go. Other variations include some form of callback to avoid blocking the main thread.

    To do asynchronous loading, you would create a method similar to [NSURLConnection sendAsynchronousRequest:queue:completionHandler:] and would probably call the mentioned method somewhere in your loader. On the callback, you would parse the data from the connection and give the callback to your method the Book object.

    If you haven’t worked with queues before, the Concurrency Programming Guide is a helpful (if slightly long and in-depth) read.

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

Sidebar

Related Questions

I'm creating a custom ViewController. This VC needs to load some data that is
I'm a little confused about how the standard library will behave now that Python
I'm a little confused by the structure of the Node class in OpenJDK's implementation
I'm a little confused as to the proper usage of VBOs in an OpenGL
Ok, I'm a little bit confused here. I'm trying to select a DAO class
I'm a little confused about how to do something that I thought would be
I'm a little confused on the proper format for the solr date fieldtype. When
I'm a little confused as to the proper use of critical sections in multithreaded
I'm a little confused by the class code. Here's what I'm trying to do:
I'm a little confused by some PHP syntax I've come across. Here is an

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.