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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:16:21+00:00 2026-06-11T05:16:21+00:00

i am adding values to NSUserDefaults at run time and making the keys as

  • 0

i am adding values to NSUserDefaults at run time and making the keys as [NSString stringWithFormat:@"decrement%@",course_id];

i am setting the objects one by one is there any way i can get all the userdefaults object whose key start with “decrement”?

or i have to go in a loop and get object by making exact key one by one?

Note :- i accept down vote as an healthy way of criticism but do write the reason so that i can improve.

  • 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-11T05:16:23+00:00Added an answer on June 11, 2026 at 5:16 am

    You can get all dictionary key of NSUserDefaults like this:

     NSArray *arrKeys = [[[NSUserDefaults standardUserDefaults] dictionaryRepresentation] allKeys]
    

    Now use NSPredicate for finding [NSString stringWithFormat:@”decrement%@”,course_id]; value in arrKeys

    NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(SELF like %@)",@"decrement"];
    NSArray *keysLikeDecrement =
    [arrKeys filteredArrayUsingPredicate:predicate];
    
    NSPredicate *aPredicate =
    [NSPredicate predicateWithFormat:@"SELF beginswith 'decrement'"];
    NSArray *beginWithDecrement =
    [arrKeys filteredArrayUsingPredicate:aPredicate];
    
    NSPredicate *bPredicate =
    [NSPredicate predicateWithFormat:@"SELF contains 'decrement'"];
    NSArray *containsWithDecrement =[arrKeys filterUsingPredicate:bPredicate];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How to add all values to observableArray in one time? Adding values in loop
I'm having trouble making this simple thing happen. I have this loop adding values
When my app starts, it loops through adding values of random numbers with keys
I have two or more javascript objects. I want to merge them adding values
I'm adding values from an ArrayList of Strings to a BST and I'm coming
How does performance for reading/adding values from/to Dictionary(Of String, SomeReferenceType) depend on the number
I am having problems with adding values to dates and also getting differences between
The above image is just adding two values and displaying the result on the
After adding the key value pairs in NSMutableDictionary, when i retrive the key/values from
I'm dynamically adding value of an input tag. The values are returned from the

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.