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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T08:15:47+00:00 2026-06-05T08:15:47+00:00

my problem is very simple (sorry my english, im speak spanish) i have NSString

  • 0

my problem is very simple (sorry my english, im speak spanish)

i have

NSString *ClaseUsuario;

AND

@property (strong, nonatomic) NSString *ClaseUsuario;

I have a method that changes the value of my variable

-(IBAction)setLabelEdad{
int val=(int)[botonEdad value];
if(val>0 && val<22){ClaseUsuario=@"C";}
if(val>=22 && val<35){ClaseUsuario=@"B";}
if(val>=35){ClaseUsuario=@"A";}

NSLog(ClaseUsuario);

}

but my problem is that when I call my variable from another method the answer is NULL

-(IBAction)VerOfertas{
NSLog(@"%@%@",@"Ofertas usario tipo: ",ClaseUsuario);   
}

I need to save the value assigned by the above method, please help! and thank you very much

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

    There are several things to fix here:

    Use a leading lowercase letter for your property: claseUsuario. This matters for KVC.

    Do not declare an ivar at all. Just use

    @syntheisze claseUsuario=_claseUsuario;
    

    (Note the leading underscore. There is seldom reason to explicitly declare an instance variable any more unless you’re writing for very old systems.)

    Except in init and dealloc, always use the accessor. So this should be self.claseUsuario = @"C";. This will ensure that memory management works correctly.

    Generally your NSLog should be of this form:

    NSLog(@"Ofertas usario tipo: %@", self.claseUsuario);
    

    Do not name your IBAction with a leading set. This can confuse KVC because it looks like an accessor.

    The likely actual cause of your problem is that either setLabelEdad is never called, or you clear claseUsuario somewhere else, or you are looking at the wrong object. Put a breakpoint in setLabelEdad to test these.

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

Sidebar

Related Questions

I´m sorry but I have to ask a very simple question. My problem is
My problem is very simple $('#button').removeAttr('type'); triggers an error on firebug type property can't
I have a big problem with very simple code. I need to get a
I have a very simple problem but cannot find a nice solution. I have
I have a very simple problem, but I can't seem to solve it. I
I have a very simple problem. I have a data frame with multiple rows
Sorry for stupid title, first. :) Problem is very simple... .gitignore ignores me! Scenario:
I have a seemingly very simple problem, but my bandwidth is so limited by
This problem seems very simple to me, but I've been unable to fix it,
My problem is very simple, yet I feel lost while looking at it ...

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.