Tuesday, May 31, 2011

How do I retrieve the phone number from the iPhone?

When Apple installs an application on the iPhone, it creates a symbolic link to a file /private/var/mobile/Library/Preferences/.GlobalPreferences.plist from Library/Preferences. Inside the plist is an entry called SBFormattedPhoneNumber.

So, in order to retrieve the phone number, simply do this

NSString *iPhoneNumber = [[NSUserDefaults standardUserDefaults] objectForKey:@"SBFormattedPhoneNumber"]

No comments: