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 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

My application is storing some data in SQL Table called Transactions. Users are able
Imagine a web-application storing some data-resource with some id which stores three attachment (e.g.
I am looking for some examples on storing some data into Google cloud storage
I am fetching data from some tables & storing it in a variable like
Seem to be having some issues storing the current date in a core data
I'm reading some data from a DB in an AsyncTask thread.... in this way:
I saved some data in the database using mysql_real_escape_string() so the single quotes are
I have a string in c# containing some data i need to extract based
I'm trying to figure out how to extract some data from a string according
Using javascript, how do I add some data to the query string? Basically I

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.