Signing Up With Mobile

Discussion in 'iOS Programming' started by oo7ml, Jun 24, 2014.

  1. oo7ml macrumors 6502

    Joined:
    Jan 20, 2010
    #1
    Hi,

    I am in the process of building a new app. The app allows users to signup with their mobile number (including the country prefix), which they then verify with a SMS.

    When the user has signed up, the app checks the users contacts in their phonebook to see which of their contacts is already signed up and using the app too. It then adds each of these contact to a Friends list.

    I have a big problem which i can't seem to get my head around:

    Most mobile numbers start with a 0 when they are used within their own country, such as 087 123 4567 for Ireland... however each country also has their own country prefix, such as +353 for Ireland, and when we use the prefix code, we usually drop the 0, such as +353 87 123 4567

    As i mentioned above, the app uses the mobile number as your unique identifier and checks to see which of your friends are already using the app. Some users will have their friends saved as 087 333 4444 and others will have them saved with the country prefix +353 87 333 4444 and therefore the app will not recognise the simple version of 087 333 4444

    Can anyone think of a way of resolving this? Thanks in advance for your help.
     
  2. Altemose macrumors G3

    Altemose

    Joined:
    Mar 26, 2013
    Location:
    Elkton, Maryland
    #2
    I do not know if there is a way to identify a country code by the basis of the numbers entered as I only know about the United States. If you could code a script to essentially check where the number is from and add the appropriate code that would work, or you could omit the initial country prefix all together as iOS locally will show any sort of the number.

    For example, if the app looks in your Contacts and also cross references it to your server, then typing in 1-800-555-1212 is the same as 555-1212. It will show the correct Contact either way. That may be a problem though as more users adopt your app or if your server cannot distinguish the different countries. 555-1212 in Poland for instance it a lot different than 555-1212 in England.
     
  3. oo7ml thread starter macrumors 6502

    Joined:
    Jan 20, 2010
    #3
    Hey, thanks for your reply.

    It's a very difficult situation to handle as some users also use 00 instead of +

    So +353 87 123 4567 is the same as 00353 87 123 4567 and 087 123 4567

    One way to do it might be to add a country prefix to all of the smaller numbers that are found in the user's phonebook.

    Now the problem is which country code do we add. I think it is probably best to use the country code that the user signed up with.
     
  4. Altemose macrumors G3

    Altemose

    Joined:
    Mar 26, 2013
    Location:
    Elkton, Maryland
    #4
    I don't know how international phone numbers work. I am lucky I call 7 states away, let alone across the world. Is there a way to only take the 087 123 4567 and determine the country code by that?

    In the United States the first three tell you the general vicinity, then the next three tell the town. If you could do that and cross reference it to a country code that would work. Otherwise just skip the country code all together...
     
  5. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #5
    You'll have to normalize the numbers, i.e. put them into a single uniform and consistent format.

    There are rules for national and international phone numbers and direct dialing. Here are some articles:
    http://en.wikipedia.org/wiki/International_direct_dialing
    http://en.wikipedia.org/wiki/E.164
    http://en.wikipedia.org/wiki/E.123

    There may be an existing library that does this normalization. I don't know of one, but it's not a unique or rare capability, so it's a fair guess that the problem has been solved before. You just need to look for it.

    I found the wikipedia articles with search terms:
    international phone numbers
    international phone dialing


    You could probably add the keywords "library" and a language name like "C" to search for C libraries. You could also try C++ as the language name. Or even take a chance with Objective-C.

    The algorithm doesn't seem too difficult, but there might be some details that are difficult or require heuristics. Even if you can't find a library in a language you can use directly, looking for one in a language you can read and use as a template would at least let you know what the difficult areas will be.
     
  6. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
  7. oo7ml thread starter macrumors 6502

    Joined:
    Jan 20, 2010

Share This Page