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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:23:38+00:00 2026-05-14T00:23:38+00:00

I have a NSMutableDictionary of NSMutableSets. Each set entry is a string, something like

  • 0

I have a NSMutableDictionary of NSMutableSets.

Each set entry is a string, something like this:

NSMutableSet *mySet = [NSMutableSet setWithObjects: 
  [NSString stringWithFormat:@"%f", time1],
  [NSString stringWithFormat:@"%f", time2],
  [NSString stringWithFormat:@"%f", time3], 
  nil];
// time 1,2,3, are  NSTimeInterval variables

then I store each set on the dictionary using this:

NSString *rightNowString = [NSString stringWithFormat:@"%f", rightNow];
[myDict setValue:mySet forKey:rightNow];
// rightNow is NSTimeInterval
// myDict is a NSMutableDictionary

as rightNow key can occur out of order, I end with a NSDictionary that is not ordered by rightNow.

How can I sort this NSDictionary by its keys considering that they are numbers stored as strings on the dictionary…?

I don’t care for ordering the sets, just the dictionary.

thanks for any help.

  • 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-14T00:23:38+00:00Added an answer on May 14, 2026 at 12:23 am
    1. If the values are NSTimeInterval, then use %f or %g etc instead of %d. The NSTimeInterval is a double.
    2. You cannot sort objects inside an NSDictionary or NSSet. If you need persistent order, you have to use an NSArray, or switch to Objective-C++ and use std::map.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this retained property declared like this: @property (nonatomic, retain) NSMutableDictionary *codes; then
If I have a data tree that is something like : NSMutableDictionary (dict1) NSMutableDictionary
So I have three NSMutableDictionary's like this: .h file NSMutableDictionary *myContainer; NSMutableDictionary *myD1; NSMutableDictionary
I have An NSMutableArray of NSMutableDictionary Which Looks like this Object 1 of Array
I have a class like this: @interface MyCollection : NSObject { NSMutableDictionary *data; }
I have the following code: NSMutableDictionary *jsonObj = [parser objectWithString:json_string error:nil]; NSString *test =
I have a problem when I add an arabic string to NSMutableArray or NSMutableDictionary
I currently have a NSArrayController whose content property is (programmatically) set to an NSMutableDictionary
I have a NSMutableDictionary with string keys and every key has its own array.
I have an NSMutableDictionary with integer values, and I'd like to get an array

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.