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

  • Home
  • SEARCH
  • 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 6803857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:23:43+00:00 2026-05-26T19:23:43+00:00

I have recently started programming for the iOS Platform but now I need some

  • 0

I have recently started programming for the iOS Platform but now I need some help figuring out how to do ‘something’:

  • For my application I fetch some JSON data and put this data as objects into an Array
  • This Array is written to my own PLIST file (in the docs directory)

Now when the users starts a sync action I:

  • Fetch the data from the PLIST
  • Get the timestamp for a certain object in the Array that came from the PLIST
  • Use timestamp in new JSON request (for the new data)

So far so good.

Now for my (current) problem -> After receiving the new data (JSON req) I wish to update the timestamp of this ‘certain’ object in the array (and write this to the Plist).

Using an NSPredicate I am able to find the right set of data within the main Array (stampArr).

NSString *documentsDir = [NSHomeDirectory()stringByAppendingPathComponent:@"Documents"];
NSString *plistPath = [documentsDir stringByAppendingPathComponent:@"stamps.plist"];

NSMutableArray *stampArr = [[NSMutableArray alloc] initWithContentsOfFile:plistPath];

NSPredicate *filter = [NSPredicate predicateWithFormat:@"eventid = 1"];
NSMutableArray *filteredStampArr = [stampArr filteredArrayUsingPredicate:filter];

But now, after I update the filteredStampArr, I want to update the main Array with the data from the filtered Array.

In other words, I need to update the object from the Array with the new ‘timestamp’ (field of object).

I could off course use something like [stampArr addObject: [filteredStampArr copy]] after changing the filterd array but that would just create a duplicate of the information. I wish to overwrite the original object.

Somehow (I think) I need a ‘pointer’ that tells me the location of the data in the original array so that I can change the data directly in the main array?

(I hope my questions is clear – If not please say so)

  • 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-26T19:23:44+00:00Added an answer on May 26, 2026 at 7:23 pm

    Get the item, find it’s index in stampArr and replace it with the newItem.

    NSArray *filteredStampArr = [stampArr filteredArrayUsingPredicate:filter];
    id item = [filteredStampArr objectAtIndex:0]; // id because the type of the item is not known
    
    NSUInteger itemIndex = [stampArr indexOfObject:item];
    
    [stampArr replaceObjectAtIndex:itemIndex withObject:newItem];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been interested in hardware programming recently, but I have not started yet. I
I recently started out with iOS programming (with the Stanford CS193P lectures from iTunes
I have recently started doing some ActionScript/Flex programming and I am... Surprised... By the
I've been a web developer for some time now, and have recently started learning
I have recently started programming in Perl (I'll skip the long story) but I've
I have recently started programming in WPF and bumped into the following problem. I
I have recently started programming in PHP. I am building a cart in PHP.
I have recently started exploring Maven, but I feel a bit overwhelmed of all
I have recently started .NET programming, and looked at both VB.NET and C#. In
I have only recently started programming significantly, and being completely self-taught, I unfortunately don'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.