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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:23:43+00:00 2026-05-14T00:23:43+00:00

I created a property list with the name propertys.plist. Then I wrote this: NSString

  • 0

I created a property list with the name propertys.plist. Then I wrote this:

NSString *path = [[NSBundle mainBundle] bundlePath];
NSString *finalPath = [path stringByAppendingPathComponent:@"speicherung.plist"];
NSMutableArray *plistData = [[NSMutableArray arrayWithContentsOfFile:finalPath] retain];
int a = [[plistData objectAtIndex:1] intValue];
NSLog(@"%i", a); // returns always 0 - Even If I set a other number in the plist
a = a + 1;
NSNumber *ff = [NSNumber numberWithInt:a];
[plistData insertObject:ff atIndex:1];
NSLog(@"%@", [plistData objectAtIndex:1]); // returns 1 - right, because 0 + 1 = 1
[plistData writeToFile:finalPath atomically:YES];

When I run this code again, I always get number 0 in the first NSLog and number 1 in the second. Why?

This code is for the iPhone.

  • 1 1 Answer
  • 1 View
  • 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-14T00:23:43+00:00Added an answer on May 14, 2026 at 12:23 am
    [plistData objectAtIndex:1];
    

    This is an NSNumber. So the address of this ObjC object is converted to an integer and assigned to a, giving the strange value. Use -intValue to extract an integer from it.

    int a = [[plistData objectAtIndex:1] intValue];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have created a new property list, and deleted the original .plist (same filename). Deleted
I have created my own Attached Property like this: public static class LabelExtension {
I created a ViewModel which has an observable property. I bind this array to
I've created a property IsLoading for my main view model. The idea is that
I am working on a custom control and have created a property in property
I created a custom button component that accepts an array as a property. I
I created a simple User Settings Dialog by binding the Property.Settings to a PropertyGrid
I've created a program that creates and populates a custom document property in an
I have created a user control (CheckedDirTree) that exposes a CheckedFolder property which in
I have created one aspx Page from that i need to access the property

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.