Breaking News
Home / iOS / iOS Snippets / How can I get Phone Number of Device from my iPhone App?

How can I get Phone Number of Device from my iPhone App?

Answer

The phone number is not accessible via an API, so its not possible to get it. For security reasons, iPhone OS restricts an application (including its preferences and data) to a unique location in the file system. This restriction is part of the security feature known as the application’s “sandbox.” The sandbox is a set of fine-grained controls limiting an application’s access to files, preferences, network resources, hardware, and so on.”

If you use the following line of code to get the phone number, your app will be rejected by Apple.

NSString *num = [[NSUserDefaults standardUserDefaults] stringForKey:@”SBFormattedPhoneNumber”];[pb_builder]

Check Also

EKCalendar – That account does not allow calendars to be added or removed

Usecase When I am trying to create a new Calendar programmatically using the EventKit API …

Leave a Reply