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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T03:29:10+00:00 2026-05-21T03:29:10+00:00

I have a problem, i have a method that when a button is pressed

  • 0

I have a problem, i have a method that when a button is pressed retrieve the information from the model core data and fill the array with the string retrived in the entity core data selected, but the array is empty, why?…

- (IBAction)action:(id)sender{
int numberanswer = [(NSSet *)[list valueForKey:@"answers"] count];
NSLog(@"The list have got: %i elements.", numberanswer);
[arrayAnswer initWithCapacity:numberanswer];
for (int i =0; i < numberanswer; i++) {
    NSManagedObject *answer = [[self sortAnswer] objectAtIndex:i];
    NSString *answerString = [[NSString alloc] initWithString:[[answer valueForKey:@"nameAnswer"] description]];
    NSLog(@"Answer: %@", answerString);
    [arrayAnswer insertObject:answerString atIndex:i];
    NSLog(@"%@", [arrayAnswer objectAtIndex:i]);
}

NSLog(@"%@", [arrayAnswer count]);

}

here:

NSLog(@"Risposta: %@", answerString);

i see that the answerString is full at every for cycle, why the array is empty?
this is the NSLog of the method:
2011-04-05 23:59:57.538 test[574:207] The list have got: 20 elements.

2011-04-05 23:59:57.540 test[574:207] Answer: This is answer1.

2011-04-05 23:59:57.541 test[574:207] (null)

2011-04-05 23:59:57.541 test[574:207] Answer: This is answer2.

2011-04-05 23:59:57.541 test[574:207] (null)

2011-04-05 23:59:57.542 test[574:207] Answer: This is answer3.

2011-04-05 23:59:57.542 test[574:207] (null)

2011-04-05 23:59:57.543 test[574:207] Answer: This is answer4.

2011-04-05 23:59:57.543 test[574:207] (null)

2011-04-05 23:59:57.543 test[574:207] Answer: This is answer5.

2011-04-05 23:59:57.544 test[574:207] (null)

2011-04-05 23:59:57.544 test[574:207] Answer: This is answer6.

2011-04-05 23:59:57.544 test[574:207] (null)

2011-04-05 23:59:57.545 test[574:207] Answer: This is answer7.

2011-04-05 23:59:57.545 test[574:207] (null)

2011-04-05 23:59:57.546 test[574:207] Answer: This is answer8.

2011-04-05 23:59:57.546 test[574:207] (null)

2011-04-05 23:59:57.546 test[574:207] Answer: This is answer9.

2011-04-05 23:59:57.547 test[574:207] (null)

2011-04-05 23:59:57.547 test[574:207] Answer: This is answer10.

2011-04-05 23:59:57.547 test[574:207] (null)

2011-04-05 23:59:57.548 test[574:207] Answer: This is answer11.

2011-04-05 23:59:57.548 test[574:207] (null)

2011-04-05 23:59:57.548 test[574:207] Answer: This is answer12.

2011-04-05 23:59:57.549 test[574:207] (null)

2011-04-05 23:59:57.549 test[574:207] Answer: This is answer13.

2011-04-05 23:59:57.549 test[574:207] (null)

2011-04-05 23:59:57.550 test[574:207] Answer: This is answer14.

2011-04-05 23:59:57.550 test[574:207] (null)

2011-04-05 23:59:57.551 test[574:207] Answer: This is answer15.

2011-04-05 23:59:57.551 test[574:207] (null)

2011-04-05 23:59:57.551 test[574:207] Answer: This is answer16.

2011-04-05 23:59:57.552 test[574:207] (null)

2011-04-05 23:59:57.552 test[574:207] Answer: This is answer17.

2011-04-05 23:59:57.552 test[574:207] (null)

2011-04-05 23:59:57.553 test[574:207] Answer: This is answer18.

2011-04-05 23:59:57.553 test[574:207] (null)

2011-04-05 23:59:57.553 test[574:207] Answer: This is answer19.

2011-04-05 23:59:57.554 test[574:207] (null)

2011-04-05 23:59:57.554 test[574:207] Answer: This is answer20.

2011-04-05 23:59:57.554 test[574:207] (null)

  • 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-21T03:29:11+00:00Added an answer on May 21, 2026 at 3:29 am
    NSString *answerString = [[NSString alloc] initWithString:[[answer valueForKey:@"nameAnswer"] description]];
    

    Shouldn’t be necessary. You have already said in your Core Data model that it is a string, so just treat it that way.

    NSString *answerString = [answer valueForKey:@"nameAnswer"];  
    

    However, I’m not sure why you’re getting (null) values. Try [arrayAnswer addObject:answerString] instead.

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

Sidebar

Related Questions

I have a problem that I have found many similar problems related to multi
I have a drum app that I've created basing it off of AVAudioPlayer instead
I'm having a problem with some jquery animations. I have dynamically created divs with
I have a workspace with the following 3 projects: Library Tests GUI The tests
I have a fairly simple view hierarchy in my iPad app. Window -> RootView
Apologies for the long post and I hope it makes some sense to someone
There is a panel in a JFrame called a WatchPanel extends JPanel which uses
I am using SwingWorkers to make my GUI responsive. But I can not understand
I am using PHP to generate 10 forms on a page which attach an
I'm trying to encapsulate my game objects by having them extend Mircosoft.Xna.Framework.GameCompenent, then merely

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.