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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:05:06+00:00 2026-05-23T19:05:06+00:00

I have a couple strings that I’m synthesizing: .h @property(nonatomic,copy) NSString* bio; .m @synthesize

  • 0

I have a couple strings that I’m synthesizing:

.h

@property(nonatomic,copy) NSString* bio;

.m

@synthesize       bio;

//connectionDidFinish method
bio = [[[profile objectForKey:@"user"] valueForKey:@"profile"] valueForKey:@"bio"];

When my tableview first loads I get an error -[NSNull length]: unrecognized selector sent to instance 0x11d45e8 in cellForRowAtIndexPath:

case kBioSectionDescriptionRow:                 
                    if ([bio length]==0 ||bio == nil) {
                        cell.textLabel.text = @"bio";   
                        cell.selectionStyle = UITableViewCellSelectionStyleNone;
                        cell.detailTextLabel.numberOfLines = 5;
                        cell.detailTextLabel.font = [UIFont fontWithName:@"Helvetica Neue" size:(14.0)];
                        cell.detailTextLabel.lineBreakMode = UILineBreakModeWordWrap;
                        cell.detailTextLabel.text = @"None"; 
                    }
                    else{
                        cell.textLabel.text = @"bio";   
                        cell.selectionStyle = UITableViewCellSelectionStyleNone;
                        cell.detailTextLabel.numberOfLines = 5;
                        cell.detailTextLabel.font = [UIFont fontWithName:@"Helvetica Neue" size:(14.0)];
                        cell.detailTextLabel.lineBreakMode = UILineBreakModeWordWrap;
                        cell.detailTextLabel.text = [NSString stringWithFormat: @"%@", bio]; 
                    }

                    break;

How can I make sure that my bio is allocated and not null?

  • 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-23T19:05:07+00:00Added an answer on May 23, 2026 at 7:05 pm

    If you @synthesize your bio property, why do you use the variable instead of the property?

    Instead of affecting the variable bio = [[[profile objectForKey:@"user"] valueForKey:@"profile"] valueForKey:@"bio"]; directly, you need instead to affect the property itself: self.bio = [[[profile objectForKey:@"user"] valueForKey:@"profile"] valueForKey:@"bio"];.


    To be more precise, writing self.bio = xx means that it calls the setter method of the bio property. This setter will manage the memory for you, meaning it will release the previous value of the bio property and copy the new value.

    If you write bio = xx instead, thus directly affecting the instance variable and not the property, no release or copy is done, so the objet you affect to the bio variable is not retained nor copied and will be destroyed at the end of the current RunLoop.

    This is why your code crash, because you then try to access the bio variable, which does not point to anything anymore (actually it points to garbage, in your case to sthg it erroneously believes to be the [NSNull null] object) as the real object has been destroyed since!


    Actually, @synthesize bio just asks the compiler to generate the code for the property’ setter and getter, and as your property is defined with the nonatomic,copy attributes, the generated setter will look like this:

    -(void)setBio:(NSString*)value {
      if (value == bio) return; // if already the exact same object (same pointer), return
    
      [self willChangeValueForKey:@"bio"]; // For KVO
      [bio release]; // release previous value
      bio = [value copy]; // copy new value
      [self didChangeValueForKey:@"bio"]; // For KVO
    }
    

    Note: Don’t forget to release the bio variable in your dealloc method (or to set the self.bio property to nil) to avoid leaking memory

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

Sidebar

Related Questions

I have a couple strings like: net_weight_(lbs) net_height_(inches) I need a regular expression that
I have a couple of strings that make up a CustomerInfo Object.I want to
I am working on an Android app and have a couple strings that I
I have a string list (TStrings) that has a couple thousand items in it.
I have couple resource DLLs that I currently load when application starts using following
We have couple different web-apps that share the same db link. The hibernate layer
ok I have couple of .NET classes that I want to use in VBA.
I have some strings that I want to delete some unwanted characters from them.
I have a couple classes that have nearly identical code. Only a string or
I have a method that gets called any time a control on my view

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.