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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T17:49:55+00:00 2026-06-05T17:49:55+00:00

I am coding a fairly complex system that uses a lot of metadata to

  • 0

I am coding a fairly complex system that uses a lot of metadata to manage dynamic objects. I am using various objective-c runtime features. I want to add stuff to mutable dictionaries which are properties within various classes. I want to do this where I know the class type and I know the property name, but I don’t want to ‘hard code’ the assignment. If I hard-coded it I could do this:

[[(myknownclass*)localClassObjectInstance knownDictionary] setObject:value forKey:key];

but what I want to do is something like this:

[[unknownClassObjectInstance {aStringContainingTheDictionaryName}] setObject:value forKey:key];

How can I reference the mutable dictionary property when I only have the name of the property at runtime?

  • 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-05T17:49:57+00:00Added an answer on June 5, 2026 at 5:49 pm

    You can use -valueForKey: to run the method:

    [(NSMutableDictionary*)[inst valueForKey:@"whateverMethodName"] setObject:o forKey:k];
    

    Or alternatively, you can use performSelector:

    SEL dictGetter = NSSelectorFromString(@"whateverMethodName");
    NSMutableDictionary* dict = [inst performSelector:dictGetter];
    [dict setObject:o forKey:k];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given that: The asset pipeline is fairly complex (coming from ASP.NET MVC, this is
So I am still fairly new to all of this, that is coding, OS
I'm coding a fairly large and complex site by myself, so do you think
I'm starting a fairly complex grails app but am a bit slow hand-coding nice
I have some fairly complex libraries that interconnect with each other to do some
I'm starting a fairly complex Swing application that heavily graphics-oriented with about 1000 separate
I'm fairly new to coding with Objective-C/Xcode, so I'm just trying my luck with
I'm fairly new to using JSON objects and I'm kinda stuck. I've got an
Coding for PHP on Mac OSX Lion, using the following within the httpd.conf file:
While coding python I'm using only 2 spaces to indent, sure PEP-8 really recommend

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.