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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T21:43:16+00:00 2026-05-20T21:43:16+00:00

I am storing some data (some floats, some strings) to a plist and then

  • 0

I am storing some data (some floats, some strings) to a plist and then reading them back. When I read them back, I assign them to some ivars in my view controller. They are just ivars, not properties.

The floats take their values fine and I can NSLog them and see that they are correct. But no matter what I try, I can’t get my NSString ivars to take the string values.

Example: array positions 6 and 7 have the strings Portland, OR" and "Pacific Daylight Time" stored in them – read back from the plist into *array.

This:

cityName = [NSString stringWithFormat:@"", [array objectAtIndex:6]];
timeZoneName = [NSString stringWithFormat:@"", [array objectAtIndex:7]];
NSLog(@" >cityName from array = %@, and now the iVar is = %@", [array objectAtIndex:6], cityName);
NSLog(@" >timeZoneName from array = %@, and now the iVar is = %@", [array objectAtIndex:7], timeZoneName);

Results in this:

>cityName from array = Portland, OR, and now the iVar is = 
>timeZoneName from array = Pacific Daylight Time, and now the iVar is = 

I put a breakpoint at the end of the method where this happens and for both NSString ivars, the little pop up message says, Invalid Summary.

  • 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-20T21:43:17+00:00Added an answer on May 20, 2026 at 9:43 pm
    cityName = [NSString stringWithFormat:@"%@", [array objectAtIndex:6]];
    

    The mistake is that you’ve missed the format specifier. Specifically though, if the objects in the array are already strings, you can just assign them straight to the ivar:

    cityName = [array objectAtIndex:6];
    

    Be careful about object ownership though. You don’t own the object returned by objectAtIndex: so if you need to use this ivar in many different methods, obtain ownership by sending retain, and relinquish ownership using release. Alternatively if you choose to establish cityName as a retaining or copying property of your class, use the dot-notation or accessor method:

    self.cityName = [array objectAtIndex:6];
    
    // or
    
    [self setCityName:[array objectAtIndex:6]];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am looking at storing some JMX data from JVMs on many servers for
I'm using jqGrid to display some data on a page. Within the controller action,
I'm reading some data from a DB in an AsyncTask thread.... in this way:
I'm reading some data like speed and curent location using a single ton class....I'm
From looking at the way some forum softwares are storing data in a database
I have a console application and am currently storing some settings data in the
I start by creating a string variable with some non-ascii utf-8 encoded data on
We're storing some Guid's in a MS SQL database. There's some legacy code that
I'm storing some additional per-user information using the AUTH_PROFILE_MODULE . We can access the
I'm hearing that some people believe storing info on the server in a session

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.