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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T08:04:49+00:00 2026-05-31T08:04:49+00:00

I have a NSMutablearray wich contain NSArrays(each array contain int and String values). When

  • 0

I have a NSMutablearray wich contain NSArrays(each array contain int and String values).
When i try to retrieve and display the data from the first array:
That was ok with the int value, it was displayed correctly.

    NSLog(@"%i",[[[lesQuestions objectAtIndex:0] objectAtIndex:0] intValue]);

But when i try to display the String value:

    NSLog(@"%@",[[[lesQuestions objectAtIndex:0] objectAtIndex:1] stringValue]);

I got exception:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString stringValue]: unrecognized selector sent to instance

I am definitely sure that the int value is the first item (index 0) and the String value is the second (index 1).
When i log the MutableArray which holds the NSArrays, i got the values correctly, so the problem is on the reference of the item i guess.

  • 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-31T08:04:50+00:00Added an answer on May 31, 2026 at 8:04 am

    The object in your array is already an NSString, so the call to stringValue is unnecessary. NSString doesn’t implement a method called stringValue, hence the exception you’re seeing. Just do this:

    NSLog(@"%@",[[lesQuestions objectAtIndex:0] objectAtIndex:1]);
    

    -intValue is a method implemented by NSNumber, to get an integer primitive out of the NSNumber instance, and your use of intValue is correct assuming the first object in the array is an NSNumber (or an NSString, which also implements -intValue).

    All that said, I don’t generally think it’s a great idea to store instances of different classes in the same array like you’re doing. You’d probably be better off using an NSDictionary where each value is stored with a unique key, say @"index" for the number and @"name" for the string.

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

Sidebar

Related Questions

I have an NSMutableArray named as totalunits . It has some data. Each data
I have a NSMutableArray: NSMutableArray *temp = //get list from somewhere. Now there is
I have a NSMutableArray that I need to search for a string and return
I have an NSMutableArray. It's members eventually become members of an array instance in
I have NSMutableArray day which contain (6 NSMutable arrays) arrays contain class Lesson{ NSString
I have some NSMutableArray in tableView which contain class Lesson @interface Lesson : NSObject
I have an NSMutableArray that contains many NSArrays. At a specific (static) index in
In my test game i have some sprites ( Bubbles = NSMutableArray) wich are
I have NSMutableArray days which contain 7 NSMutableArrays,7 NSMutableArrays contain class Lesson. @interface Lesson
I have NSMutableArray which contains NSObjects. Each NSObject contains a NSString as property which

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.