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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:22:00+00:00 2026-05-27T06:22:00+00:00

I have an iPhone application that pulls some JSON data from a server and

  • 0

I have an iPhone application that pulls some JSON data from a server and then parses it into an array of dictionaries which contains sub-arrays and sub-dictionaries.

Right now I have this stored in an ivar timeTablethen copying it to filteredTimetable before looping through filteredTimetable and removing the objects I don’t need.

The problem I am having is when I try restore the array so it can be filtered again. The objects that have been removed previous from the copied NSArray are removed from the original NSArray too.

filteredTimeTable = [[NSMutableArray alloc] initWithArray:timeTable copyItems:YES];

I assume this is because filteredTimeTable is simply storing a pointers to the objects in timeTable rather than copying the memory.

Here is an example of my data structure:

    [
        {"time":"09:00",
        "events": [
            { "module":"COMP319", "type":"lecture", "room":"BROD-108:80" }
            { "module":"COMP320", "type":"lab", "room":"BROD-LT" }
        ]},

When I remove a module that is no longer required I can’t restore the element.

So is there anyway to do a full copy including all the sub-objects?

  • 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-05-27T06:22:00+00:00Added an answer on May 27, 2026 at 6:22 am

    You could just keep the original JSON string around and re-parse it.

    If you don’t want to do that for some reason, and if it’s all valid property list objects (NSArray, NSDictionary, NSString, NSNumber, NSDate, NSData), the simplest approach is to use property list serialization:

    NSData *archive = [NSPropertyListSerialization dataWithPropertyList:originalObject format:NSPropertyListBinaryFormat_v1_0 options:0 error:NULL];
    NSMutableArray *copiedObject = [NSPropertyListSerialization propertyListWithData:archive options:NSPropertyListMutableContainers format:NULL error:NULL];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have developed an iPhone application that fetches data from internet. I want to
I have an iphone application that gets data from a set of php files.
I have an iPhone application that reads RSS feeds from a YouTube channel. However,
I have an application that works some what similar to how iPhone's Contact application
I have an IPhone application that I want to attempt login and do some
I have an iPhone application that uses a sqlite3 database for saving data and
I do have a java server. I am trying to build IPhone application that
I have an iPhone application that relies heavily on communicating with an external server.
I have an application that is loading html from a remote server in a
I have an iPhone application that adds new contacts via the Address Book Framework.

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.