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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:12:58+00:00 2026-05-14T04:12:58+00:00

In summary, I am having a problem where I read what I expect to

  • 0

In summary, I am having a problem where I read what I expect to be an NSNumber from an NSArray contained in a property list and instead of getting a number such as ‘1’, I get what looks to be a memory address (i.e. ‘61879840’). The numbers are clearly correct in the property list. Anyone know why this may be happening and what I can do to fix it?

Below is my process for creating the property list and reading it back.

Creating the property list

I have created a simple Objective-C property list with arrays of integers within one root array:

<array>
  <array>
    <integer>1</integer>
    <integer>2</integer>
  </array>
  <array>
    <integer>1</integer>
    <integer>2</integer>
    <integer>5</integer>
  </array>
  ... more arrays with integers ...
</array>

The arrays are NSArray objects and the integers are NSNumber objects. The property list has been created and serialized using the following code:

// factorArray is an NSArray that contains NSArrays of NSNumbers as described above
// serialize and compress factorArray as a property list, Factors-bin.plist
NSString *error;
NSString *rootPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
                                                        NSUserDomainMask, YES)
                      objectAtIndex:0];
NSString *plistPath = [rootPath stringByAppendingPathComponent:@"Factors-bin.plist"];
NSData *plistData = [NSPropertyListSerialization
                     dataFromPropertyList:factorArray
                     format:NSPropertyListBinaryFormat_v1_0
                     errorDescription:&error];

Inspecting the created plist, all values and types are correct, leading me to believe that I’ve properly created the list.

Reading the property list

The property list is read in as Data and then converted to an NSArray:

NSString *path = [[NSBundle mainBundle] pathForResource:@"Factors" ofType:@"plist"];
NSData *plistData = [[NSData alloc] initWithContentsOfFile:path];
NSPropertyListFormat format;
NSString *error = nil;
NSArray *factorData = (NSArray *)[NSPropertyListSerialization
                                  propertyListFromData:plistData
                                  mutabilityOption:NSPropertyListImmutable
                                  format:&format
                                  errorDescription:&error];

Cycling through factorData to see what it contains is where I see the erroneous integers:

for (int i = 0; i < 10; i++) {
  NSArray *factorList = (NSArray *)[factorData objectAtIndex:i];
  NSLog(@"Factors of %d\n", i + 1);
  for (int j = 0; j < [factorList count]; j++) {
    NSLog(@"  %d\n", (NSNumber *)[factorList objectAtIndex:j]);
  }
}

I see all the correct number of values, but the values themselves are incorrect, i.e.:

Factors of 3
  61879840 (should be 1)
  61961200 (should be 3)
Factors of 4
  61879840 (should be 1)
  61943472 (should be 2)
  61943632 (should be 4)
Factors of 5
  61879840 (should be 1)
  61943616 (should be 5)
  • 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-14T04:12:59+00:00Added an answer on May 14, 2026 at 4:12 am

    Try logging the intValue of the NSNumber instead:

    NSLog(@"  %d\n", [(NSNumber *)[factorList objectAtIndex:j] intValue]);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

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.