Getting a phone number of the iOS device is programmatically is not feasible. Apple doesn’t encourage it. You can get the phone number using private API’s but that will result in rejection of your application from the Apple App Store.
As per the apple development guideline apps should be self-contained in their bundles, and may not read or write data outside the designated container area and device number is not available within your application’s container.
As per Apple developer forum −
Regardless of which programming language you use, Apple doesn't make the phone number associated with a device available to developers.