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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:01:58+00:00 2026-05-26T15:01:58+00:00

I have an NSMutableArray initializated with 10 elements. the problem born when i try

  • 0

I have an NSMutableArray initializated with 10 elements. the problem born when i try to get an element it runs an exception..

I create the array in this way:

NSMutableArray *selected = [[NSMutableArray alloc] init];
    [selected setValue:[NSString stringWithFormat:@"casa_selected.png"]forKey:[NSString stringWithFormat:@"%d",1]];
    [selected setValue:[NSString stringWithFormat:@"chiave_selected.png"]forKey:[NSString stringWithFormat:@"%d",2]];
    [selected setValue:[NSString stringWithFormat:@"gatto_selected.png"]forKey:[NSString stringWithFormat:@"%d",3]];
    [selected setValue:[NSString stringWithFormat:@"giacca_selected.png"]forKey:[NSString stringWithFormat:@"%d",4]];
    [selected setValue:[NSString stringWithFormat:@"nonno_selected.png"]forKey:[NSString stringWithFormat:@"%d",5]];
    [selected setValue:[NSString stringWithFormat:@"lumaca_selected.png"]forKey:[NSString stringWithFormat:@"%d",6]];
    [selected setValue:[NSString stringWithFormat:@"cane_selected.png"]forKey:[NSString stringWithFormat:@"%d",7]];
    [selected setValue:[NSString stringWithFormat:@"occhiali_selected.png"]forKey:[NSString stringWithFormat:@"%d",8]];
    [selected setValue:[NSString stringWithFormat:@"portafogli_selected.png"]forKey:[NSString stringWithFormat:@"%d",9]];
    [selected setValue:[NSString stringWithFormat:@"telecomando_selected.png"]forKey:[NSString stringWithFormat:@"%d",10]];

When i try to get element:

[selected valueForKey:[NSString stringWithFormat:@"%d",2]]

it runs this exception:

2011-11-05 10:04:37.426 TrovaChiavi[22307:11f03] -[__NSArrayI isEqualToString:]:
unrecognized selector sent to instance 0x78317b0 
2011-11-05 10:04:37.494 TrovaChiavi[22307:11f03] *** Terminating app due to uncaught 
exception  'NSInvalidArgumentException', reason: '-[__NSArrayI isEqualToString:]: 
unrecognized selector sent  to instance 0x78317b0'
*** First throw call stack:
(0x1e01052 0x1343d0a 0x1e02ced 0x1d67f00 0x1d67ce2 0x39c68f 0x630ece 0x63eb6e 0x63f13f 0x9258
 0x32464e 0x4e2f 0x1e02ec9 0x2615c2 0x26155a 0x306b76 0x30703f 0x3062fe 0x286a30 0x286c56  
 0x26d384 0x260aa9 0x16e9fa9 0x1dd51c5 0x1d3a022 0x1d3890a 0x1d37db4 0x1d37ccb 0x16e8879
 0x16e893e 0x25ea9b 0x26ed 0x2665)
 terminate called throwing an exception[Switching to process 22307 thread 0x11f03]
  • 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-26T15:01:59+00:00Added an answer on May 26, 2026 at 3:01 pm

    Use a NSMutableDictionary for key/value associations. NSMutableArray is for index based store/access.

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

Sidebar

Related Questions

I have an NSMutableArray something like this array =[[a1,b1,c1],[a2,b2,c2],[a3,b3,c3].......] and I access this array
I have An NSMutableArray of NSMutableDictionary Which Looks like this Object 1 of Array
I have a NSMutableArray: NSMutableArray *temp = //get list from somewhere. Now there is
I have an NSMutableArray. It's members eventually become members of an array instance in
I have this code: tableList = [[NSMutableArray alloc] initWithObjects:@First View,@Second View,nil]; I have synthesized
i have one problem when i sort the NSMutablearray using date and time wise.
I have a class wich is initialized like this. // myclass.h @property(nonatomic,retain) NSMutableArray *daysOfWeek;
I need to create a mutable two-dimensional array in Objective-C. For example I have:
I have an NSMutableArray with contents I want to replace with NSNull objects. This
I have an NSMutableArray called myObjectArray which contains and array of NSObjects called myObject.

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.