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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:43:39+00:00 2026-05-12T14:43:39+00:00

I have an NSArray of strings and I want to add a certain amount

  • 0

I have an NSArray of strings and I want to add a certain amount of rows to the outline view depending on how many strings are in the array, each with the title of the String that was added.

I think it would involve looping through the array like this.

for(NSString *title in array) {
    JGManagedObject *theParent = 
        [NSEntityDescription insertNewObjectForEntityForName:@"projects"
                                      inManagedObjectContext:managedObjectContext];
    [theParent setValue:nil forKey:@"parent"];
    [theParent setValue:@"Project" forKey:@"name"];
    [theParent setValue:[NSNumber numberWithInt:0] forKey:@"position"];

}
  • 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-12T14:43:39+00:00Added an answer on May 12, 2026 at 2:43 pm

    Don’t bother. The tree controller sits between the model (The Core data store that Spark is using) and the view (your source view). Instead of adding from the array to the tree controller, you should be adding from the array to the data store.

    The tree controller will pick up the changes in the model and show the changes in the view.

    Edit:

    (Bear in mind it is hard to debug from a distance.)

    With Garbage Collection, if you don’t hold on to your objects, they are liable to be cleaned up from underneath you.

    Try this and see what happens:

    for(NSString *title in array) {
        NSManagedObjectContext *moc = [self managedObjectContext];
        JGManagedObject *theParent = 
            [NSEntityDescription insertNewObjectForEntityForName:@"projects"
                                          inManagedObjectContext:moc];
        [theParent setValue:nil forKey:@"parent"];
        // This is where you add the title from the string array
        [theParent setValue:title forKey:@"name"]; 
        [theParent setValue:[NSNumber numberWithInt:0] forKey:@"position"];
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to get strings that have specific length in NSArray. The array has
I have an NSArray of Strings and what I want to do is create
I have an array with a bunch of strings and I want to check
I have an NSArray that I want to filter out certain objects using an
I have NSArray and I want to remove duplicates from it. I know that
I have an array named 'names' with strings looking like this: [name_23_something, name_25_something, name_2_something];
I have an NSArray consisting of NSNumbers and I want to convert this to
Let's say I've got an array with strings. NSArray *names = [NSArray arrayWithObjects: @One,
I have a pList of strings which I'm bundling into an NSMutable Array. NSString
Possible Duplicate: Sort NSArray of date strings or objects Hello, I want to sort

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.