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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:41:36+00:00 2026-06-13T19:41:36+00:00

I am using AFIncrementalStore to fetch data from a webservice and persist it in

  • 0

I am using AFIncrementalStore to fetch data from a webservice and persist it in a SQLite database through app launches.

The webservice doesn’t follow REST standards, so I can’t use AFRestClient but have a subclass of AFHTTPClient that implements AFIncrementalStoreHTTPClient.

All works well for the first level of data, but the response I am handling also contains arrays with other objects:

[
{
    "PID": 6,
    "Actors": [
        {
            "PID": 0,
            "Name": "Kiefer Sutherland"
        },
        {
            "PID": 0,
            "Name": "Carlos Bernard"
        },
        {
            "PID": 0,
            "Name": "Mary Lynn Rajskub"
        },
        {
            "PID": 0,
            "Name": "Jude Ciccolella"
        },
        {
            "PID": 0,
            "Name": "Glenn Morshower"
        },
        {
            "PID": 0,
            "Name": "Tanya Wright"
        },
        {
            "PID": 0,
            "Name": "Alberta Watson"
        },
        {
            "PID": 0,
            "Name": "Eric Balfour"
        },
        {
            "PID": 0,
            "Name": "Regina King"
        },
        {
            "PID": 0,
            "Name": "Peter MacNicol"
        },
        {
            "PID": 0,
            "Name": "Marisol Nichols"
        },
        {
            "PID": 0,
            "Name": "Jayne Atkinson"
        },
        {
            "PID": 0,
            "Name": "Carlo Rota"
        },
        {
            "PID": 0,
            "Name": "Janeane Garofalo"
        },
        {
            "PID": 0,
            "Name": "Rhys Coiro"
        },
        {
            "PID": 0,
            "Name": "Jeffrey R. Nordling"
        },
        {
            "PID": 0,
            "Name": "Bob Gunton"
        },
        {
            "PID": 0,
            "Name": "Colm Feore"
        },
        {
            "PID": 0,
            "Name": "Annie Wersching"
        },
        {
            "PID": 0,
            "Name": "Cherry Jones"
        },
        {
            "PID": 0,
            "Name": "D.B. Woodside"
        },
        {
            "PID": 0,
            "Name": "James Morrison"
        },
        {
            "PID": 0,
            "Name": "Gregory Itzin"
        },
        {
            "PID": 0,
            "Name": "Jean Smart"
        },
        {
            "PID": 0,
            "Name": "Louis Lombardi"
        },
        {
            "PID": 0,
            "Name": "Sarah Clarke"
        },
        {
            "PID": 0,
            "Name": "Roger R. Cross"
        },
        {
            "PID": 0,
            "Name": "Reiko Aylesworth"
        },
        {
            "PID": 0,
            "Name": "Elisha Cuthbert"
        },
        {
            "PID": 0,
            "Name": "Lana Parrilla"
        },
        {
            "PID": 0,
            "Name": "Kim Raver"
        },
        {
            "PID": 0,
            "Name": "Dennis Haysbert"
        },
        {
            "PID": 0,
            "Name": "Leslie Hope"
        },
        {
            "PID": 0,
            "Name": "Xander Berkeley"
        },
        {
            "PID": 0,
            "Name": "James Badge Dale"
        },
        {
            "PID": 0,
            "Name": "Penny Johnson Jerald"
        },
        {
            "PID": 0,
            "Name": "Sarah Wynter"
        },
        {
            "PID": 0,
            "Name": "Shohreh Aghdashloo"
        },
        {
            "PID": 0,
            "Name": "Laura Harris"
        },
        {
            "PID": 0,
            "Name": "David Anders"
        },
        {
            "PID": 0,
            "Name": "Katee Sackhoff"
        },
        {
            "PID": 0,
            "Name": "Mykelti Williamson"
        },
        {
            "PID": 0,
            "Name": "Anil Kapoor"
        },
        {
            "PID": 0,
            "Name": "Chris Diamantopoulos"
        },
        {
            "PID": 0,
            "Name": "John Boyd"
        },
        {
            "PID": 0,
            "Name": "Freddie Prinze Jr."
        }
    ],
    "Artwork": [
        {
            "Filetype": "jpg",
            "Id": "291317649",
            "Offset": 0,
            "Rating": 1,
            "Type": 2
        },
        {
            "Filetype": "jpg",
            "Id": "-419936433",
            "Offset": 1,
            "Rating": 1,
            "Type": 2
        },
        {
            "Filetype": "jpg",
            "Id": "-431274161",
            "Offset": 2,
            "Rating": 1,
            "Type": 2
        },
        {
            "Filetype": "jpg",
            "Id": "117154410",
            "Offset": 0,
            "Rating": 1,
            "Type": 3
        },
        {
            "Filetype": "jpg",
            "Id": "1179197275",
            "Offset": 1,
            "Rating": 1,
            "Type": 3
        },
        {
            "Filetype": "jpg",
            "Id": "-1912564655",
            "Offset": 2,
            "Rating": 1,
            "Type": 3
        },
        {
            "Filetype": "jpg",
            "Id": "885093068",
            "Offset": 0,
            "Rating": 1,
            "Type": 1
        }
    ],
    "ContentRating": "TV-14",
    "DateAdded": "/Date(-3600000+0100)/",
    "EpisodeCount": 192,
    "ExternalId": [
        {
            "Id": "76290",
            "Site": "TVDB"
        },
        {
            "Id": "tt0285331",
            "Site": "IMDB"
        }
    ],
    "Genres": [
        "Action and Adventure",
        "Drama"
    ],
    "Id": "76290",
    "IsProtected": false,
    "Rating": 8.9,
    "Title": "24",
    "UnwatchedEpisodeCount": 0,
    "Year": 2001
}
]

In my datamodel I have an entity TVShow that has properties for the id, rating, title, unwatched episodes, episode count and the year. I am mapping those in my HTTPClient in
attributesForRepresentation:ofEntity:fromResponse:
like this:

if ([entity.name isEqualToString:@"TVShow"]) {
    [mutableAttributes setValue:[representation valueForKey:@"Id"] forKey:@"showId"];
    [mutableAttributes setValue:[representation valueForKey:@"Title"] forKey:@"title"];
    [mutableAttributes setValue:[NSNumber numberWithInteger:[[representation valueForKey:@"Year"] integerValue]] forKey:@"year"];
    [mutableAttributes setValue:[NSNumber numberWithInteger:[[representation valueForKey:@"EpisodeCount"] integerValue]] forKey:@"episodeCount"];
    [mutableAttributes setValue:[NSNumber numberWithInteger:[[representation valueForKey:@"UnwatchedEpisodeCount"] integerValue]] forKey:@"unwatchedEpisodeCount"];
}

My thought was that I could add another entity Artwork with an one-to-many relationship between TVShow and Artwork, but I don’t know how to map and define that. All my tries in the last days resulted in crashes (probably due to a lack of understanding of CoreData).

Any help with that would be greatly appreciated, as I would really like to use AFIS in my app.

Thanks!

  • 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-13T19:41:38+00:00Added an answer on June 13, 2026 at 7:41 pm

    (1st part isn’t really an answer)

    I would discourage using the NSIncrementalStore unless you know Core Data very well. It is far easier and way less error prone to simply pull JSON over the wire with e.g. AFNetwork and then insert those objects into a normal Core Data stack backed by an SQLite store. You’ll probably find that a more feasible solution.

    (2nd part)

    That said, you can get it to work, but you’d have to do some tricks, since you don’t have any id or other unique identifier for the Artwork objects. You’d have to put the into the cache (the 2nd Core Data stack that AFIncrementalStore is using) and then put the NSManagedObjectIDs for those objects into the TVShow’s values for that relationship.

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

Sidebar

Related Questions

Using Core Data, I have a fetch request to fetch the minimum of a
Using Java,I have to fetch multiple sets of values from an XML file to
using Telerik.WinControls.Data; using Telerik.WinControls.UI.Export; namespace Directory { public partial class radForm : Form {
Using mercurial, I've run into an odd problem where a line from one committer
Using Android TelephonyManager an application can obtain the state of data activity over the
Using php/html, I want to retrieve email addresses (plus other information) from MySQL and
Using emacs on Ubuntu 11.10. I want to connect to a SQL Server database
Using Yii, I want to delete all the rows that are not from today.
Using WPF/PRISM I want to log my messages through ILoggerFacade to my GUI (A
Using CMake I want to check if a particular function (cv::getGaborKernel) from OpenCV library

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.