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

We used to use SourceSafe, and one thing I liked about it was that
Never used a cache like this before. The problem is that I want to
I used to work in a place where a common practice was to use
When used like this: import static com.showboy.Myclass; public class Anotherclass{} what's the difference between
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
Well, here is a full sample that works but the console vanishes right after
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
I saw this thread but wanted to confirm: How to convert NSNumber objects 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.