Yes I know full well its not possible to get the phone number using public APIs.
I want to know what the latest situation is regarding how to get the phone number using private APIs for an enterprise app with iOS11. All the past questions I could find are years old, couldn't find anything recent.
I tried this:
extern NSString* CTSettingCopyMyPhoneNumber();
+(NSString *) phoneNumber
{
NSString *phone = CTSettingCopyMyPhoneNumber();
return phone;
}
But am not able to run this however as I wasn't able to add the com.apple.coretelephony.Identity.get entitlement without getting a signing error saying the executable was signed with invalid entitlements.
Is it still possible with iOS 11 to get the phone number programmatically using non-public APIs for an enterprise app on a non jailbroken device?
CTSettingCopyMyPhoneNumber()
and[[AKDevice currentDevice] phoneNumber]
rely internally on aXPC
inter process call. This is the actual fetch mechanism heavily guarded for the valid entitlement. – Sequacious