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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T09:32:50+00:00 2026-06-05T09:32:50+00:00

I want to SET items in an array in a dictionary. I have an

  • 0

I want to SET items in an array in a dictionary.
I have an NSDictionary below, an instance called”currentCityNode”. In that Dictionary is an array item (amongst other things). The array item is called “TheConnections”
The code below successfully reads the array.

 NSArray *theConnectionsArray = [currentCityNode objectForKey:@"TheConnections"];
 (theConnectionsArray now contains the previously loaded values '3','7', and '9')

Now I want to set ONE of the values in this array. Make the second value ‘7’ a ‘5’.

I have tried a few variations, not able to get it yet.

[currentCityNode addObject:notsurewhattoputhere forKey:@"TheConnections"];
  • 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-05T09:32:51+00:00Added an answer on June 5, 2026 at 9:32 am

    Your array and dictionary must be mutable and something like this should work. If theConnectionsArray is already mutable then you wont have to use mutableCopy.

    NSMutableArray *theConnectionsArray = [[currentCityNode objectForKey:@"TheConnections"] mutableCopy];
    [theConnectionsArray replaceObjectAtIndex:1 withObject:@"5"];
    [currentCityNode setObject:theConnectionsArray forKey:@"TheConnections"];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a set of items that can be in various states. I want
I have a Stackpanel and want that the items automatically set their sizes regarding
I want to set the items order that are in an array Collection and
I have a set of items, from which I want to select DISSIMILAR tuples
I have a set where i want to find items in it. Right now
I saw in the documentation that now you can have an array of items
I have my shared user defaults plist that looks something like: menuItems (Array) Item
I have a Collection, and I want to remove all items that have a
I have make a script. That set li items on different positions on the
I have an array of images that I want to loop through infinitely ie.

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.