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

  • SEARCH
  • Home
  • 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 7667417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:05:51+00:00 2026-05-31T15:05:51+00:00

Here is part of a class definition in an iOS program using reference counting

  • 0

Here is part of a class definition in an iOS program using reference counting (ARC):

@interface CapViewController : UIViewController 
{
    NSString *bottomBn;
    NSString *topBn;
}

@property (nonatomic, strong) NSString *bottomBn;
@property (nonatomic, strong) NSString *topBn;

@end

In the implementation I synthesize them:

@implementation CapViewController

@synthesize bottomBn;
@synthesize topBn;

The problem is when I try to assign values. If I step through the following lines in a class method (first time each instance variable is being used):

bottomBn = [NSString stringWithString:@"bottomBn"];        
topBn = [NSString stringWithString:@"topBn"];

After the first line has executed, the value of topBn becomes @”bottomBn” and bottomBn is nil
The second line has no impact.

If I change the order the instance variables are defined in the class, i.e.:

NSString *topBn;
NSString *bottomBn;

then the first assignment has no effect and the second assignment results in “topBn” being assigned to bottomBn.

Using local variables it works as expected:

NSString *localbottomBn = [NSString stringWithString:@"defaultbottombutton"];        
NSString *localtopBn = [NSString stringWithString:@"defaulttopbutton"];

This seems bizarre behavior to me. I’d appreciate 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-31T15:05:52+00:00Added an answer on May 31, 2026 at 3:05 pm

    I have same problems with other types and objects (even CGFloat and CGPoint). I think the problem is in debugger. Try to print you strings instead of look variables via debugger. For me NSLog function print what I expected.

    I have no ideas why debugger have this unpredictable behavior (may be it’s a bug), but now I prefere “NSLog debugging”. It is sad.

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

Sidebar

Related Questions

Here's part of my Django app's models.py : class Person(models.Model): birth_year = WideYear(null=True, blank=True)
Here's the relevant part of the Dice class: import java.util.*; class Dice { String
Here is the first part of my controller code: public class ControlMController : Controller
here is the part if having error. Fatal error: Using $this when not in
Here is part of my web.config for my WCF service: <bindings> <basicHttpBinding> <binding name=sslBinding>
Here is part 1 of our problem (Loading a dynamically generated XML file as
Here is part of my web.xml: <context-param> <param-name>contextConfigLocation</param-name> <param-value> classpath:application-config.xml </param-value> </context-param> application-config.xml uses
Here's part of my code for a jQuery word counter. My question is: how
EDIT Sorry I forgot the most important part here. Each key can have more
Here is a part of my html code (video urls marked with a django-template

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.