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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:47:21+00:00 2026-05-27T13:47:21+00:00

I used NSNumber class. but methods that can use is different in follow environments.

  • 0

I used NSNumber class.

but methods that can use is different in follow environments.

First is a picture in command line tool environment. (Mac os x)

Second is a picture in single view application environment. (iOS)

: Can’t use isGreaterThan:, isGreaterThanOrEqualTo:, isLessThan:.. Etc. methods

Why did that?

1] first picture

first picture

2] second picture

second picture

  • 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-27T13:47:22+00:00Added an answer on May 27, 2026 at 1:47 pm

    Those methods you’re seeing on the Mac aren’t actually part of the NSNumber class but instead are part of an informal protocol called NSComparisonMethods that is only available on Mac OS X. The methods in this protocol are convenience methods that actually just use the compare: method already available on many Cocoa classes. If you wanted, you could implement these methods as a category on NSNumber quite easily. Here is how I would implement -isGreaterThanOrEqualTo:.

    @interface NSNumber (ConvenientComparison)
    
    - (BOOL)isGreaterThanOrEqualTo:(id)object;
    
    @end
    
    @implementation NSNumber (ConvenientComparison)
    
    - (BOOL)isGreaterThanOrEqualTo:(id)object
    {
        if (![object isKindOfClass:[NSNumber class]])
        {
            // Not sure what NSNumber does if you pass in something that isn't a number.
            // Handle this case
            return NO;
        }
    
        NSNumber *numberToCompareAgainst = (NSNumber *)object;
    
        NSComparisonResult comparisonResult = [self compare:numberToCompareAgainst];
    
        if (comparisonResult == NSOrderedSame || comparisonResult == NSOrdereedDescending)
            return YES;
    
        return NO;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I convert NSNumber 1234567 to 12,34,567? I have used the NSNumberFormatter for
I used this code to compare two NSNumber objects, but it never passed the
Used code I found on SO to use the COM based Acrobat Reader to
I used ReconstructMe to scan my first half body (arm and head). The result
i used this code: List<string> lists=new List<string>(apple,orange,banana,apple,mang0,orange); string names; names=lists.Distinct() is that correct?
I know that categories should not be used to override a method in the
Example: I have an NSInteger and I wrap that into an NSNumber object. Now
I want to make some NSNumber constants via the same style used for NSStrings
i have used an avaudiorecoder to record user's voice. it records it but when
This may be a repeated question,but please help me.I used the code below for

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.