A
A
Alexander Zarochintsev2014-05-18 16:05:20
Objective-C
Alexander Zarochintsev, 2014-05-18 16:05:20

How to adapt an application for x64?

Good day, please tell me how to adapt the application for x64, for example I write:
For x32

stringNumbersYearsUser = [NSString stringWithFormat:@"%d", [stringTodayYear integerValue] - [stringYearsUsers integerValue] - 1];

Normally, XCode says nothing, but if you change it to iPhone x64 in the simulator, it suggests writing like this:
stringNumbersYearsUser = [NSString stringWithFormat:@"%ld", [stringTodayYear integerValue] - [stringYearsUsers integerValue]];

But, then when I switch to x32, it offers to change it back, since what data types should I use?
Thank you for your attention!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
ins52, 2014-05-21
@ins52

So that there are no warnings, we bring it to a 64-bit value and output it already

NSInteger notifyID = 5;
NSLog(@"%ld, (long)notifyID);

D
Dmitry Skogorev, 2014-05-19
@EnterSandman

stackoverflow.com/questions/19801844/how-can-i-mak...

O
one pavel, 2014-05-19
@onepavel

It's all about the size of long in the system. The integerValue method returns an NSInteger, which is defined as typedef long NSInteger. Accordingly, in a 32-bit system it is 4 bytes, and in a 64-bit system it is 8 bytes, to display a number with a greater bit depth, you need to change the format specifier. I suppose it's enough to leave ld and forget about 32-bit warning

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question