how can i get phone number from swift?

Hello,


how can i get the phone number from swift? is this possible?


regards

Answered by LCS in 23713022

Regardless of which programming language you use, Apple doesn't make the phone number associated with a device available to developers.

Apple provides a vendor specific identifier from UIDevice for general identification purposes, but it isn't 100% reliable.

https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIDevice_Class/index.html#//apple_ref/occ/instp/UIDevice/identifierForVendor


If you want access to phone numbers in Contacts, you can access that information using the AddressBook Framework, but you will need the permission of the user.

https://developer.apple.com/library/ios/documentation/AddressBook/Reference/AddressBook_iPhoneOS_Framework/index.html

Accepted Answer

Regardless of which programming language you use, Apple doesn't make the phone number associated with a device available to developers.

Apple provides a vendor specific identifier from UIDevice for general identification purposes, but it isn't 100% reliable.

https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIDevice_Class/index.html#//apple_ref/occ/instp/UIDevice/identifierForVendor


If you want access to phone numbers in Contacts, you can access that information using the AddressBook Framework, but you will need the permission of the user.

https://developer.apple.com/library/ios/documentation/AddressBook/Reference/AddressBook_iPhoneOS_Framework/index.html

My iPad and my iPod touch don't have phone numbers? What are you asking about? 😕

how can i get phone number from swift?
 
 
Q