Trouble with phone number in ipad mini

I am developing an app that shows a 10 digit number. When I run it in my iPhone 6 it shows ok. It displays 8183874201. But when I run it in my old iPad Mini it show the number in a format like this -467821389.
The code I am running is:

var telefonoCasaStaff = self.timelineData[0].objectForKey("TelCasa") as Int
self.telCasaTextLabel.text = String(telefonoCasaStaff)

Any ideas?

Upvotes: 0

Views: 39

Answers (1)

Martin R
Martin R

Reputation: 539765

Int is a 64-bit integer on 64-bit devices, and a 32-bit integer on 32-bit devices.

8183874201 = 0x1E7CC0299 exceeds the range of 32-bit integers, and apparently is truncated to 32-bit.

You could use Int64, but generally, storing phone numbers as integers makes not much sense, and you should use strings instead.

Upvotes: 3

Related Questions