5

Currently I am developing an authentication module for my application. The user provides his phone number and a SMS with some pin code is send to him.

The user enters the code and if it is valid his phone number is authenticated. Maybe you know WhatsApp, it does quite the same when you run the app first time.

However if the user puts a new sim card in his phone he should authenticate it again.

I want to know how to determine if phone number has changed. I read in some other question that it is not possible to determine the phone number itself. But e.g. WhatsApp recognizes that there is another phone number.

Any ideas?

DarkLeafyGreen
  • 69,338
  • 131
  • 383
  • 601

1 Answers1

7

Update 2

One (not the best) way it's detecting carrier changing. Here you can see how to get carrier's name. Save it at first launch and do compare on next launches.

Update 3

I'd recommend to you look at Core Telephony Network reference and especially at CTTelephonyNetworkInfo reference

subscriberCellularProviderDidUpdateNotifier allow you respond on events such like:

... when the user’s cellular provider information changes. This occurs, for example, if a user swaps the device’s SIM card with one from another provider, while your application is running

Community
  • 1
  • 1
5hrp
  • 2,230
  • 1
  • 18
  • 18
  • Hm, actually I have to do it again with SMS, else apple would reject my application... – DarkLeafyGreen May 11 '11 at 07:16
  • Excuse me, but what WhatsApp do, when sim card changed? (I have no abilities to download it now). Does they send pin code to new number immediately or suggest user to input his new number? – 5hrp May 11 '11 at 07:28
  • No you have to enter your phone number again. My problem is that I have to route the user to the authentication dialog when phone number has changed – DarkLeafyGreen May 11 '11 at 07:36
  • Look at my **Update 2**, please – 5hrp May 11 '11 at 07:48
  • Look at my **Update 3**, please :) – 5hrp May 11 '11 at 07:58
  • I voted down because of the UDID proposal. This might change as well, just because the user changed device or because of jailbreaking. More info at http://stackoverflow.com/questions/1110921/iphone-udid-restrictions – phi May 11 '11 at 08:00
  • Ok, I did it. Thanks @Irene. It was a bad idea – 5hrp May 11 '11 at 08:05
  • May I ask if anyone knows how to retrieve the phone number of the SIM? I have searched but seems not possible. – topace Oct 06 '11 at 08:35
  • 1
    @topace now it's impossible to get phone number due to Apple's privacy policy. Maybe you should search for such possibilities with jailbreak – 5hrp Oct 06 '11 at 09:03