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

The Archive Base Latest Questions

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

This is probably a long shot, but I’ve got objects with a lot of

  • 0

This is probably a long shot, but I’ve got objects with a lot of properties. The values of these objects are populated from NSDictionary’s created from a database request. Because of this, there may be NSNull values contained in those NSDictionaries that will automatically get assigned to the properties. I need the properties to automatically discard values/objects that aren’t of the correct type. Currently I do it like this:

- (void) setViewID:(NSString *)viewID{
    if (!viewID || [viewID isKindOfClass:[NSString class]]) _viewID = viewID;
}

But that ends up being a lot of extra code when I’ve got 30-50 properties. Is there a way to synthesize this behavior? It seems like it would be a common enough requirement, but I can’t seem to find a way to do it aside from writing it all out.

  • 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-05T04:49:41+00:00Added an answer on June 5, 2026 at 4:49 am

    Why not check for NSNull when you are going through the dictionary? E.g.

    for (NSString *key in dictionary) {
        id value = [dictionary objectForKey:key];
        if (value == [NSNull null]) {
            value = nil;
        }
        [self setValue:value forKey:key];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is probably a long shot but I asked a question about converting one
This is probably a long shot, but I'm trying to minimize the repition in
This is probably a long shot, but I have vague sense I ran across
Its been a long day and this is probably extemely simple but how do
this is probably trivial, but i have a quite long sql query and echo
This is probably easy, but I'm trying to convert from a source which provides
It's probably a long-shot that anyone can answer this without seeing all the source
It's probably a long shot, but is there an add-in for VS2010 that can
This is a long shot, but does anyone know of an algorithm for estimating
This question is probably a long shot. I can't figure out the errors I'm

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.