Getting the local iPhone number through SDK
I am looking for a SDK API to retrieve the device’s local phone number
from the SIM card. Is there a way to do it?
- Telephone number format should be international,Is there any Regex for phone number validation in iPhone
- Formatting UITextField's text as Phone Number as user types in
- Is it possible to get iphone's phone number programmatically in 2011?
- Is it possible to turn off the dial assist feature in iOS programmatically?
- How to open the ios Native dialer app from my App
- How to remove non numeric characters from phone number in objective-c?
4 Solutions Collect From Internet About “Getting the local iPhone number through SDK”
There’s no reliable way. You’ll find code online that tells you to look up SBFormattedPhoneNumber, and sometimes that works, but not consistently. Mostly it’s people who brought their phone number over from another cell carrier. In those cases, you get a phone number, but not one for the current phone, and not one that’s guaranteed to be valid for anything at all (it may not even be unique).
I have no basis for saying whether this is a few people or a lot, but it’s an undocumented key that’s inherently unreliable.
This method refers to the number stored in iTunes at time of activation… so, don’t use it. From 4.x you can take advantage from CoreTelephony framework to get many information about the network, but still no number…
CFShow([[NSUserDefaults standardUserDefaults] objectForKey:@"SBFormattedPhoneNumber"]); NSString *path = [NSHomeDirectory() stringByAppendingPathComponent:@"Library/Preferences/.GlobalPreferences.plist"]; NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:path]; CFShow(dict);
Take a look at this blog post here.
NSString *num = [[NSUserDefaults standardUserDefaults] stringForKey:@”SBFormattedPhoneNumber”]; NSLog(@”Phone Number: %@”, num);
- Restore InApp purchase using swift, iOS
- How to call presentViewController from inside class
- Detect if browser supports autoplay of embedded media – YouTube playVideo() and iOS
- Asterisk sometimes on variable type, sometimes on variable name. Why?
- iOS Reachability Not Recognizing When Host is Removed
- How to get the advantages of Scenekit's level editor programatically
- Conflicting Gesture Recognizers on UITableView
- Enumerate NSArray using blocks to find and store all indexe's of all NSStrings in array
- Do you need to call willChangeValueForKey: and didChangeValueForKey:?
- How to add items to an Outlet Collection in Xcode
- uitabbar change background color of one uitabbaritem on iOS7
- Firebase crash reporting for iOS doesn't send crashes despite successful init
- iphone notification results in “unrecognized selector sent to instance…”
- Check if the current time is between other times
- Using UIPinchGestureRecognizer to scale uiviews in single direction