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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T15:58:11+00:00 2026-06-03T15:58:11+00:00

I am getting -[__NSArrayI addObject:]: unrecognized selector sent to instance 0x10dd15ee0 here, when I

  • 0

I am getting “-[__NSArrayI addObject:]: unrecognized selector sent to instance 0x10dd15ee0” here, when I try to addObject to an NSMutableArray. I’m not sure why.

I have a set of custom classes, that are nested. WTEvent has an NSMutableArray property called mats that consists of WTMat objects. mats has an NSMutableArray of WTBout objects called bouts.

I want to be able to update one bout in bouts while leaving the rest of the bouts alone. Here, I locate the mat that I need to assign a bout to. If it’s not initialized, I initialize it. Then, if it’s empty, I try to add a newBout to it, and it crashes.

Shouldn’t I be able to change elements of a NSMutableArray like this?

// Locate the correct mat
WTMat* mat = [self getMatFromBoutKey:[updateData valueForKey:@"boutKey"]];
WTBout* newBout = [WTBout buildBoutFromDictionary:updateData];

// need to initialize bouts
if ([mat bouts] == nil) {
    NSLog(@"Initializing bouts");
    NSMutableArray* newBouts = [[NSMutableArray alloc] init ];
    [mat setBouts:newBouts];
}

if ([[mat bouts] count]) {
    // if bouts has bouts, then adjust the bout stack

    NSLog(@"bouts is not empty");
} else {
    // if bouts is empty, just add a bout

    NSLog(@"Adding a newBout");
    NSMutableArray* oldBouts = [mat bouts];
    NSLog(@"oldbouts: %@", [oldBouts description]);
    [oldBouts addObject:newBout]; // -[__NSArrayI addObject:]: unrecognized selector sent to instance 0x10dd15ee0

}

WTMat.h:

#import <Foundation/Foundation.h>

@interface WTMat : NSObject
{
    NSString* matName;
    NSString* boutKey;
    NSString* multicastAddress;
    NSMutableArray* bouts;
}

@property (strong, nonatomic) NSString* matName;
@property (strong, nonatomic) NSString* boutKey;
@property (strong, nonatomic) NSString* multicastAddress;
@property (copy, nonatomic) NSMutableArray* bouts; 

@end

Log:

2012-05-12 08:14:00.491 Wrestling Tools[12623:403] Initializing bouts
2012-05-12 08:14:00.492 Wrestling Tools[12623:403] Adding a newBout
2012-05-12 08:14:00.492 Wrestling Tools[12623:403] oldbouts: (
)
2012-05-12 08:14:00.492 Wrestling Tools[12623:403] -[__NSArrayI addObject:]: unrecognized selector sent to instance 0x10dd15ee0
2012-05-12 08:14:00.492 Wrestling Tools[12623:403] -[__NSArrayI addObject:]: unrecognized selector sent to instance 0x10dd15ee0
2012-05-12 08:14:00.494 Wrestling Tools[12623:403] (
    0   CoreFoundation                      0x00007fff96783fc6 __exceptionPreprocess + 198
    1   libobjc.A.dylib                     0x00007fff92375d5e objc_exception_throw + 43
    2   CoreFoundation                      0x00007fff968102ae -[NSObject doesNotRecognizeSelector:] + 190
    3   CoreFoundation                      0x00007fff96770e73 ___forwarding___ + 371
    4   CoreFoundation                      0x00007fff96770c88 _CF_forwarding_prep_0 + 232
    5   Wrestling Tools                     0x000000010dc49343 -[WTUpdater fullUpdate:] + 835
  • 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-03T15:58:13+00:00Added an answer on June 3, 2026 at 3:58 pm

    This is your problem:

    @property (copy, nonatomic) NSMutableArray* bouts; 
    

    The “copy” parameter makes an immutable copy of the array, which means when this line runs:

    NSMutableArray* oldBouts = [mat bouts];
    

    You’re actually getting an ordinary NSArray, which is why you get the unrecognised selector error.

    The easy solution to this is to change the “copy” keyword to “strong”. Slightly harder would be leave it as copy but to instead change the type of the property to NSArray, though that would complicate modifying the array.

    Finally, you could make your own implementation of setBouts: which does do a copy using the -mutableCopy method to ensure the copy it makes is mutable.

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

Sidebar

Related Questions

I have tried to initialize my NSMutableArray 100 ways from Sunday, and NOTHING is
NSMutableArray *tempMutableArray = [[NSMutableArray alloc] init]; if (street != NULL) { [tempMutableArray addObject:(NSString *)street];
I have the following declarations in my model.h: @interface Model: NSObject { NSMutableArray *myMutableArray;
I am getting an error called Thread 1: Program recieved signal:EXC_BAD_ACCESS here is my
Hii, I am getting values in uitableview from model class which has NsDictionary.Here is
I'm getting some leaks (obvserved by Instruments) when trying to reuse an existing NSMutableArray
Ok, so I'm getting better with SQLite queries ... but obviously not a master
I'm stumped or just not finding info I need, I have an object that
DBPostListViewController has a NSArray *postList that needs to be set. I keep getting Terminating
I'm getting what XCode labels an ARC Issue that I have a rather hard

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.