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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:17:30+00:00 2026-06-02T16:17:30+00:00

Hello I’m new to iPhone development. I try to add move data from NSDictionary

  • 0

Hello I’m new to iPhone development.
I try to add move data from NSDictionary to data member of calls that i created.
When i “setWeightMeasure” nothing happened.

any suggestions?

the code that don’t work:

NSDictionary *responseBodyProfile = [responseBody objectFromJSONString];
NSLog(@"%@",responseBodyProfile);
// the output is : 
"{ "profile": {"goal_weight_kg": "77.0000", "height_cm": "179.00", 
  "height_measure": "Cm", "last_weight_date_int": "15452", 
   "last_weight_kg": "99.0000", "weight_measure": "Kg" }}""

[responseBody release];

if (responseBodyProfile != nil ){
    NSDictionary *profile =[responseBodyProfile valueForKey:@"profile"];

    NSLog(@"%@\n",[profile objectForKey:@"weight_measure"]);// Output : "kg"

    [self.myUser setWeightMeasure:[profile objectForKey:@"weight_measure"]];
    NSLog(@"%@", [self.myUser WeightMeasure]); // Output : "(null)"
 }

the H file properyty:

@property (nonatomic, retain) UserData* myUser;

UserData.h:

#import <Foundation/Foundation.h>

@interface UserData : NSObject{
    NSString* Weight;
    NSString* Height;
    NSString* GolWeight;
    NSString* WeightMeasure;

}

@property (nonatomic, retain) NSString* Weight;
@property (nonatomic, retain) NSString* Height;
@property (nonatomic, retain) NSString* GolWeight;
@property (nonatomic, retain) NSString* WeightMeasure; 

@end

UserData.m

#import "UserData.h"

@implementation UserData
@synthesize Weight, Height, GolWeight, WeightMeasure;

-(id)init{
    self.Weight = @"0";
    self.Height = @"0";
    self.GolWeight = @"0";
    self.WeightMeasure = @"0";
    return self;
}

-(void)dealloc{
    [Weight release];
    [Height release];
    [GolWeight release];   
    [WeightMeasure release];

    [super dealloc];
}

@end
  • 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-02T16:17:31+00:00Added an answer on June 2, 2026 at 4:17 pm

    Use valueForKey instead of objectForKey in this line:

    [self.myUser setWeightMeasure:[profile objectForKey:@"weight_measure"]];
    

    like this:

    [self.myUser setWeightMeasure:[profile valueForKey:@"weight_measure"]];
    

    You might also want to use, since the values could be read as NSNumbers

    [self.myUser setWeightMeasure:[[profile valueForKey:@"weight_measure"] stringValue]];
    

    And why do you use strings instead of floats? Wouldn’t that make your life easier when you’d need to perform some comparisons?

    Also check if you have allocated memory for “myUser”, that might be the case as well.

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

Sidebar

Related Questions

Hello i have this code var queue = new BlockingCollection<int>(); queue.Add(0); var producers =
Hello i´m trying to set info from a post method into a variable that
Hello, Im working on a solution for Android that will record calls (both out
Hello good morning everyone, i have an iphone app which is still in development
Hello! I would like to extract all citations from a text. Additionally, the name
Hello guys I need to pass a string array over to a setter that
Hello I have this problem with PyQt4-dev-tools that include: * a user interface compiler
hello i'm studying iOS programming i created a project, which is an empty application
Hello Stack Overflow users, I have a fun problem that I have in my
Hello everyone i am designing a web page that contains many textboxes and a

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.