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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T09:15:40+00:00 2026-06-06T09:15:40+00:00

I got an NSMutableArray, created like this: NSMutableArray *expr = [[NSMutableArray alloc] init]; [expr

  • 0

I got an NSMutableArray, created like this:

NSMutableArray *expr = [[NSMutableArray alloc] init]; 
    [expr addObject:[NSNumber numberWithDouble:3.0]];
    [expr addObject:@"+"];
    [expr addObject:@"%x"];
    [expr addObject:@"*"];
    [expr addObject:[NSNumber numberWithDouble:4.0]];

Later on, I pass it to method where it is known as (id) anExpression, and I try to determine what kind of object this is with introspection:

if ([[anExpression class] isEqual:[NSMutableArray class]]) {
    // Some code I only want to do if it IS a Mutable array
}

But, that returns false, and my code isn’t executed. I tried NSLog‘ing [NSMutableArray class] and that gives me NSMutableArray. Not quite a surprise.
But when I try NSLog‘ing expr‘s class, I get __NSArrayM.

Why is this? How should I get around this?

I am not that familiar with Objective-C, so please explain things. I don’t like doing things I don’t understand.

  • 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-06T09:15:41+00:00Added an answer on June 6, 2026 at 9:15 am

    Your check is incorrect. It should be either

    if ([[expr class] isEqual:[NSMutableArray class]]) {
    

    or

    if ([expr isKindOfClass:[NSMutableArray class]]) {
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created an NSMutableArray object by NSMutableArray *array = [[NSMutableArray alloc]init]; and used method
I've got method: -(NSMutableArray*)getTheCountriesEurope:(int)continentID { NSMutableArray* euCountriesArray=[[[NSMutableArray alloc]init]autorelease]; const char* sqlContinents=SELECT countries.countryID,countries.countryName\ FROM countries\
I've got an array of NSNumber objects created thusly: myArray = [[NSMutableArray alloc] initWithObjects:[NSNumber
Got this code in my controllers (void)viewDidLoad method self.purchasesPerClassification = [NSMutableDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@Moo,nil] forKeys:[NSArray
I'd like to return an NSMutableArray with three objects. Here's what I've got: NSMutableArray
I got code like this: Match.h: #import <Foundation/Foundation.h> #import player.h @interface Match : NSObject
I've got a NSMutableArray (containing NSMutableDictionary instances) bound to an NSArrayController (the NSArrayController is
Got this error message while trying to load view: The model item passed into
Got a question for some jQuery wizard who might stumble upon this. When I
got a problem, can't get my head around this jquery and would appreciate your

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.