New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
iOS Development Discussion on developing apps for the iOS platform.

Signing Up With Mobile


Post Reply New Thread Subscribe

 
Thread Tools
oo7ml

 
Member Since: Oct 18, 2011
Posts: 109
oo7ml is on a distinguished road

oo7ml is offline
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.
QUOTE Thanks
vansmith

 
vansmith's Avatar
 
Member Since: Oct 19, 2008
Location: Toronto
Posts: 17,818
vansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond repute
Mac Specs: 2012 13" MBP (2.5 i5, 8GB)

vansmith is offline
Moved to the development forum.

The solution is here is rather simple - simply read the first character of the phone number string, check to see if it's a zero and then do something accordingly. If it isn't, they likely have the country code at the front.

I'm not sure what language you're using here but effectively, you want something that lets you get a slice of a string.

Important Links: Community Guidelines : Use the reputation system if you've been helped.
M-F Blog :: Write for the blog
Writing a Quality Post
QUOTE Thanks
oo7ml

 
Member Since: Oct 18, 2011
Posts: 109
oo7ml is on a distinguished road

oo7ml is offline
Hey, thanks for your reply.

Sometimes users save the +353 as 00353 too, so the proposal above wouldn't work.

Any other ideas?
QUOTE Thanks
vansmith

 
vansmith's Avatar
 
Member Since: Oct 19, 2008
Location: Toronto
Posts: 17,818
vansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond repute
Mac Specs: 2012 13" MBP (2.5 i5, 8GB)

vansmith is offline
You'll need to code a conditional that accounts for all possibilities. As far as I can tell, there's no way around that unless you read only the last seven digits or so and use that as a unique identifier. This would get around having to deal with the beginning part of the string. That would give you ten million possible unique combinations (0000000 - 9999999). Granted, that wouldn't account for area/country codes though. However, you could run a check against the DB if one of those seven digit codes matched another and then assign a different number based on that (or have a second column for area/country code).

Important Links: Community Guidelines : Use the reputation system if you've been helped.
M-F Blog :: Write for the blog
Writing a Quality Post
QUOTE Thanks
oo7ml

 
Member Since: Oct 18, 2011
Posts: 109
oo7ml is on a distinguished road

oo7ml is offline
Thanks Vansmith, i have thought of this, however i don't think that will work either as a mobile number in the US could have the last 7 digits the same as a mobile in Ireland.

US: 1 (555) 555 5555
Ireland: 087 555 5555
QUOTE Thanks
vansmith

 
vansmith's Avatar
 
Member Since: Oct 19, 2008
Location: Toronto
Posts: 17,818
vansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond repute
Mac Specs: 2012 13" MBP (2.5 i5, 8GB)

vansmith is offline
Hence the second column for country code.

So, if the seven digit numbers are the same, consult the second column with the country code. Your psuedocode would look something like:
Code:
variable number = get results from phone column
variable countrycode = get result from country code column
if number == what the user input then
     check to see if number exists elsewhere in the column
     if it doesn't then
          ...do what you need to do...
     if it does exist elsewhere then
          get the country code input by the user
          check country code against the country codes in the rows with number
          if the countrycode == what the user input && the number == what the user input then
               ...do what you need to do...
It's not the most elegant psuedocode but it should do the job of explaining what it is that I'm trying to explain.

Important Links: Community Guidelines : Use the reputation system if you've been helped.
M-F Blog :: Write for the blog
Writing a Quality Post
QUOTE Thanks
oo7ml

 
Member Since: Oct 18, 2011
Posts: 109
oo7ml is on a distinguished road

oo7ml is offline
Ha, yes i get you but problem is that we are relying on how users are saving their friend's phone numbers in their actual phonebook, some will not have a country code prefix and others will :-)

I wonder would using the last 8 digits be safe (maybe not)
QUOTE Thanks
vansmith

 
vansmith's Avatar
 
Member Since: Oct 19, 2008
Location: Toronto
Posts: 17,818
vansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond repute
Mac Specs: 2012 13" MBP (2.5 i5, 8GB)

vansmith is offline
Quote:
Originally Posted by oo7ml View Post
Ha, yes i get you but problem is that we are relying on how users are saving their friend's phone numbers in their actual phonebook, some will not have a country code prefix and others will :-)
You can't account for all user choices.

Quote:
Originally Posted by oo7ml View Post
I wonder would using the last 8 digits be safe (maybe not)
Maybe but you're still going to run into an issue where the beginning of the phone number string will differ.

One thing to note as well is the existence of shared country codes. For example, North American countries all have the same country code (1). It might help reading this.

Important Links: Community Guidelines : Use the reputation system if you've been helped.
M-F Blog :: Write for the blog
Writing a Quality Post
QUOTE Thanks
oo7ml

 
Member Since: Oct 18, 2011
Posts: 109
oo7ml is on a distinguished road

oo7ml is offline
Yeah, i know Whatsapp are able handle this so they must use some clever method.

All of the options i can think of don't cover all choices.
QUOTE Thanks

Post Reply New Thread Subscribe


« App Dev Images | code signing .pkg files »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Mobile me DuLac OS X - Operating System 1 06-24-2014 09:03 AM
iPhone 5s t mobile audio issue fire2007 iPhone Hardware and Accessories 1 04-28-2014 07:02 PM
mobile broadband dongles don't work with Mac 10.9.2. jules14 OS X - Operating System 3 04-23-2014 05:53 PM
Lightroom Goes Mobile with New iPad Solution!! TattooedMac iOS and Apps 1 04-08-2014 06:24 AM

All times are GMT -4. The time now is 08:22 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?