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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:26:16+00:00 2026-06-04T13:26:16+00:00

I want to have an Entity property in Core Data be a 64-bit integer.

  • 0

I want to have an Entity property in Core Data be a 64-bit integer. Since the model is going to run on iOS, and as far as I know these devices are not 64-bit, I figured that NSNumber was the way to go (core data gives you the option of objects or scalar properties for primitive types).
I’m assuming that NSNumber will internally take care of keeping track of a suitable representation for 64 bits.

Now, I need to subtract 1 from this “64 bit” property in my entity at some point (in case you didn’t guess, the 64 bit property is the max_id parameter in the Twitter API), but to do so, I first need to unbox the number inside the NSNumber property.

So should i get the intValue? longValue? unsignedIntValue? unsignedLongValue? long long? which one?

  • 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-04T13:26:18+00:00Added an answer on June 4, 2026 at 1:26 pm

    Since you already know the type (64 bit integer), you don’t need to check for it.

    To get a 64 bit integer out of a NSNumber, do one of the following:

    NSInteger myInteger = [myNSNumber integerValue];
    int64_t   myInteger = [myNSNumber integerValue];
    

    In order to just add one to it, you can use something like this:

    myNSNumber = [NSNumber numberWithInteger:[myNSNumber integerValue]+1]];
    

    Note that iOS does have 64 bit data types like int64_t and NSInteger.

    EDIT:
    If the only reason that you are using NSNumber is to store the 64 bit integer, you can just declare the property like this in your model subclass and skip the unboxing/boxing altogether:

    @property (nonatomic) int64_t myIntValue;
    

    Note that core data does this by default if you select the Use scalar properties for primitive data types option of the Create NSManagedObject Subclass feature.

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

Sidebar

Related Questions

I have an entity called Task in my Core Data model. The Task entity
I have a simple Core Data store with an entity Cost with an integer
I have an entity with a ModifiedDateTime property which I want to be updated
I have a core data stack which contains an entity called 'Client'. Each client
Given the following Core Data Model: -> : to-one releationship ->>: to-many relationship Entity
I have an entity which might have a parent entity. I want to run
I have an Core Data entity called Album; an album has a relationship to
I have this structure in a entity of core data: ID Region SubRegion SubRegionID
I have a Core Data model which has three entities: A, B, and C.
I have a Core Data entity that uses a custom subclass of NSManagedObject. 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.