views:

39

answers:

2

Hi!

I am struggling with very simple thing: I receive some ids by http request as a string. I know they represent 64bit integer id numbers. How can I convert them to the 64 bit Integers (NSNumber or NSInteger)?

Functions like:

[nsstring integerValue],
[nsstring intValue]

seems to be 32bit limited (max value:2147483647).

Any Hints?

Data model with 64bit integer properties compiles fine so it means iPhone supports such a numbers for a god sake. It must be some simple conversion method. It is so popular in http connection based devices.

+2  A: 

have you tried longLongValue ?

willcodejavaforfood
[NSNumber numberWithLongLong:[nsstring longLongValue]]; This is what I needed to store it as an object. Thank You. I was simply scared of this long long type ;-) Why not just long once?
Lukasz
A: 

if they have a fixed length, you could cut them on each 9th number, make the intvalue of the cutted parts and add the values with the 10^9-factor. surely not the most elegant way, but it should work

nico
Thanks - but it must be simple. I use it very often in constructing queries. Anyway - it is too basic thing to go so deep down to the forest ;-)
Lukasz