Getting country calling prefix

0 votes

I was just curious if there were any simple methods for retrieving the country calling code from a user's phone.

For instance, I want my app to automatically fill in the users' country calling code.

Code +1 will be returned if the user is in the United States, +83 for users in China, +61 for users in Australia, etc.

I looked around, but all I saw was:-

NSLocale *locale = [NSLocale currentLocale];
NSString *countryCode = [locale objectForKey: NSLocaleCountryCode];


which does not return the calling prefix but rather the country code abbreviation?

Please lend a hand!

Sep 19, 2022 in Others by Soham
• 9,710 points
841 views

1 answer to this question.

0 votes
For a class that offers both this data and phone number formatting, see:- https://github.com/rmaddy/RMPhoneFormat
answered Sep 20, 2022 by Aditya
• 7,680 points

Related Questions In Others

0 votes
0 answers

I am getting this data from my server

May 29, 2019 in Others by anonymous
416 views
0 votes
1 answer
0 votes
1 answer

Error: No toolchains found in the NDK toolchains folder for ABI with prefix: llvm

Over two years has passed, now and ...READ MORE

answered Feb 11, 2022 in Others by Soham
• 9,710 points
3,153 views
0 votes
1 answer

I am getting Failed to load resource: net::ERR_BLOCKED_BY_CLIENT with Google chrome

These errors are usually generated from an ...READ MORE

answered Feb 16, 2022 in Others by Soham
• 9,710 points
5,444 views
0 votes
1 answer

Is there a way to to check if a picture was taken on that iPhone?

Actually, the model and manufacturer information is ...READ MORE

answered Sep 22, 2022 in IOS by Rahul
• 9,680 points
663 views
0 votes
1 answer

Detect if the device is iPhone X

The response to your query is "no" ...READ MORE

answered Nov 8, 2022 in IOS by Rahul
• 9,680 points
1,013 views
0 votes
0 answers

How to receive single tap and hold Remote-Control Event with iOS

I'm looking for my app to listen ...READ MORE

Nov 8, 2022 in Mobile Development by gaurav
• 23,260 points
453 views
0 votes
0 answers

How to use iOS Reachability

I'm developing an iPhone app that uses ...READ MORE

Nov 9, 2022 in Mobile Development by gaurav
• 23,260 points
561 views
0 votes
1 answer

Getting "net::ERR_BLOCKED_BY_CLIENT" error on some AJAX calls

Matching the URLs against a type of ...READ MORE

answered Feb 22, 2022 in Others by Aditya
• 7,680 points
1,687 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP