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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:41:29+00:00 2026-05-18T12:41:29+00:00

On a past project (pre-iOS 4.0), I wrote the following category method on NSSortDescriptor

  • 0

On a past project (pre-iOS 4.0), I wrote the following category method on NSSortDescriptor:

+ (id)sortDescriptorWithKey:(NSString *)key ascending:(BOOL)ascending;

When Apple released the iOS SDK 4.0, it included the exact same method (which presumably does exactly the same thing). Is it possible to write a category that is only added to the runtime either if you’re running a particular OS version, or probably more to the point, if there isn’t already a method declared with the same signature?

In this case, it’s probably safe to override the sortDescriptorWithKey:ascending: method with a category, which will give both iOS 3 and iOS 4 support, since my version will almost certainly do the same thing. I’d still prefer not to mess with system defined methods if possible, due to the (unlikely) possibility of breaking things in edge cases.

  • 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-18T12:41:30+00:00Added an answer on May 18, 2026 at 12:41 pm

    Not directly, no.

    The way I’d recommend doing this would be to have a my_sortDescriptorWithKey: which can then check if the class responds to sortDescriptorWithKey: and uses that if it does, otherwise use your own implementation.

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

Sidebar

Related Questions

I was plugging away on an open source project this past weekend when I
Successfully used jquery-infinite-carousel in the past but for my current project I need it
We have a ASP.NET website project. In the past, we had been using asmx
If anyone's seen me posting lots of questions about this project in the past
My project broke somewhere in the past 25 revisions. I need to isolate the
In the past I had quite some reusable code in my project which I
I've been working on an open-source project for the past 2 months. So far
I had created a framework for a project in the past that one of
I am evaluating PostSharp for a new project but cannot seem to get past
I want to document a Java project I'm working on. In the past I've

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.