How to programmatically get phone number with iOS11 for Enterprise app - ios

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?

Related

Get equal and unique identifier for 2 apps installed in the same iOS device

I have two apps for iOS, one made with Swift and another with Ionic3, I need an unique and equal identifier for both of them. The Ionic app has user authentification but the other one doesn't have anything, just sends data to an API with the UDID (code below), so in the API if both identifiers are the same the data is saved. It's weird, I know, but this is a legacy code that I can't refactor.
In the native one I have this UDID:
NSString* udid = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
In Ionic3 I have #ionic-native/unique-device-id and #ionic-native/device but the UDID returned are always different. When user logs in the Ionic app it updates the UDID field in the database.
They need to send the same identifier even after reinstall them. How can I achieve that with minimal changes or without touching the native app.
Maybe it's possible to get anothers app UDID from Ionic3? Or from some kind of common storage between the two apps. Since the Ionic app needs to check if the other app is installed I'm also using URI Scheme.

Check if an ios device was blocked [duplicate]

This question already has answers here:
UIDevice uniqueIdentifier deprecated - What to do now?
(32 answers)
How to preserve identifierForVendor in ios after uninstalling ios app on device?
(8 answers)
Closed 4 years ago.
Is there a way to identify a device which was blocked by my app, so they cannot create a second account?
I have read a little bit about Unique Identification and DeviceCheck, Apple's own IPA. I also considered to ask for the phone number when the user signs up, but this seems a little complicated for me and the other solutions only work if the user is kind enough no to reinstall the app.
On other approach I had was to get some information (Carrier, iPhone Name, iOS Version, iPhone Model etc.), pack it into one String and use it as an unique id, but some of this information can be changed easily and I don't think Apple would like this solution.
I am sure that there are better/simpler solutions.
(This task seems very easy in Android. I plan to use this statement: UUID.randomUUID().toString();)
That info could help:
I am planning to connect this app to Firebase.
In the best case, the solution would work from iOS 8.0 to the current iOS Version.
I am open for any kind of creative solution in Swift or Objective C.
We can achieve this by using SSKeychain. Using SSKeychain once we have set value for particular in the SSkeychain then that value will remain their even we have removed that application from your ios device.
Please check following e.g Objective- C
if([SSKeychain passwordForService:#"your application bundle identifier" account:#"user"] == nil)
{
NSString *UUID = AppDelegate.GetUUID;
[SSKeychain setPassword:UUID forService:#"your application bundle identifier" account:#"user"];
NSString *retrieveuuid = [SSKeychain passwordForService:#"your application bundle identifier" account:#"user"];
NSLog(#"retrieveuuid %#",retrieveuuid);
}
+ (NSString *)GetUUID {
CFUUIDRef theUUID = CFUUIDCreate(NULL);
CFStringRef string = CFUUIDCreateString(NULL, theUUID);
CFRelease(theUUID);
return (__bridge NSString *)string;
}

How to identify iOS device uniquely instead of using UUID and UDID [duplicate]

This question already has answers here:
Unique Identification of iOS device for iOS 7.0 and above
(6 answers)
Closed 6 years ago.
In my iOS app, I have to restrict the user to use iOS app per device. To do this I found a solution that we can use the UUID (Universally Unique Identifier) or UDID (Unique Device Identifier). But according to this answer I can't use UUID, because if app gets deleted or reinstalled UUID has been getting changed and I don't want this. Also Apple rejects apps if app uses UDID.
Is there any way to identify iOS device uniquely.
Apple has done away with the approach of UDIDs and will reject apps that use the same for unique device identification.
Source: TNW
What you are looking for is Vendor ID
I'm using this library for my projects, and it's working like a charm, please try :
https://github.com/blackpixel/BPXLUUIDHandler
easy to use :
Import BPXLUUIDHandler.h
Retrieve the UUID with
[BPXLUUIDHandler UUID]
Thats all...
Here is some info from project's github page :
As of iOS 5, Apple has deprecated the device unique identifier api and
hasn’t provided a friendly Obj-C replacement, instead recommending
CFUUIDCreate and NSUserDefaults.
CFUUIDCreate isn’t very complicated and neither is NSUserDefaults, but
this solution fails in a few different ways:
It’s not a quick one-shot call to get the UUID; you have to write your own wrapper to make it friendly
It doesn’t persist; deleting the app blows away the UUID (can be persisted if stored in the keychain though)
There’s no way to share it between apps

Finding IMEI number using Objective-C [duplicate]

This question already has answers here:
How to get IMEI on iPhone?
(7 answers)
Closed 2 years ago.
I need to find a way to get the IMEI number of an iPhone device. This question is not a duplicate.
I have gone through several forums including SO, and had no luck finding an answer.
Some say Apple doesn't allow developers to see the IMEI number (SO post), and some say to use UDID instead (SO post). Some say that UDID is deprecated (in iOS 7).
I need to know the following:
1.) Does Apple permit developers to retrieve the IMEI number of the device?
2.) How can i programatically do it?
3.) In case if Apple doesn't allow developers to gather the IMEI number, do they provide any other unique number for the device?
4.) Some suggest to use Telephony framework. If i do so, will apple reject my application?
Apple does not allow you to identify a device any more.
UDID, MAC address and all other device identifiers are no longer accessible or allowed by Apple.
Apple suggest that you use either UUID (which you will need to store your self or), identifierForVendor or advertisingIdentifier.
Apple is now also rejecting app that use the advertisingIdentifier and not showing any advertisements apps.
Any means to get the IMEI number are using private methods, which is also not allowed by Apple anymore. And your mobile app might/will get rejected because of this.
Unfortunately, there is no way to get a unique identifier for a device which will always remain the same. Apple no longer allows you to access the UDID. And in iOS 7, all devices' MAC addresses return the same value, so that is no longer useful either.
However, iOS does now give access to two types of identifiers which can be used to identify a device. They are:
Vendor ID - [UIDevice identifierForVendor]. This is a unique identifier which is the same for all apps from the same vendor or company. It will remain the same, so long as the user has at least one app from the vendor installed on their device. So if you have 3 apps, the vendor ID will remain the same unless the user uninstalls all three apps, and then reinstalls. This is not so useful if you only have one app - if the user deletes it and then reinstalls it, it will change.
Advertiser ID - [UIDevice advertisingIdentifier]. This is a unique identifier meant for advertising purposes. But if you use it for non-advertising purposes they, for the most part, won't care. Under most circumstances, the advertising identifier will not change, even if the user deletes and reinstalls the app. However, there is an option in the iOS settings to reset the advertising identifier, which will change it. This is meant to that users can choose to disassociate themselves from any advertising information which has been collected about them. But this is a very advanced setting and I doubt that many users would do this frequently enough that it would be a problem for you.
You can obtain IMEI using private frameworks -See this Question but probably your app will be rejected from app store then.
If you want to obtain some device identifier to use in your application you must use uniqueIdentifier property defined in UIDevice class
(Available in iOS 6.0 and later):
NSString *UDID = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
You can save UUID in keychain and user it as unique number. It won't change until user will reset iOS.
If you want to obtain the IMEI there is no way (on a non-jailbroken device). If you wish to identify the user take a look at this answer. Please pay attention to all documentation/answers written before iOS7 since things have changed.

iPhone/iPad unique identifier BESIDES UUID/UDID?

The project I am on is requesting two (or even three) unique identifiers from the iPhone or iPad. I know, I know... the UDID should be enough but we are trying to see if there are any other unique identifiers that we can use.
I can get the IMEI, serial number, MAC Address, etc. from the phone using the IOKit.framework but apparently this is frowned upon by Apple and any app using this framework will be rejected.
Does anyone have any other ideas, or identifiers that I am missing that could be used?
Thanks!
This question is old however a new unique, vendor based, identifier has now been added to replace the deprecated UUID in iOS 6.
The [UIDevice identifierForVendor] should now be used instead of [UIDevice uniqueIdentifier] which is now deprecated as of iOS 5.0
Example usage:
NSUUID *uuid = [[UIDevice currentDevice] identifierForVendor];
NSString *uuidString = [uuid UUIDString];
You can get the ICCID and the IMSI (if they exist).
NSString *commcenter = #"/private/var/wireless/Library/Preferences/com.apple.commcenter.plist";
NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:commcenter];
NSString *ICCID = [dict valueForKey:#"ICCID"];
NSString *IMSI = [dict valueForKey:#"IMSI"];
I think that's as far as you will get. I don't know any other options for getting an universal ID.
UPDATE 2013-03-13:
This has probably changed since I wrote this answer almost two years ago. I don't even remember what was the iOS version at the moment. Also as #joshis correctly pointed out in the comments "You cannot legally do this, since your app would read stuff from outside the application sandbox and therefore, it will be rejected, as specified in AppStore Review Guidelines...".
From Apple:
The value in this property remains the same while the app (or another
app from the same vendor) is installed on the iOS device. The value
changes when the user deletes all of that vendor’s apps from the
device and subsequently reinstalls one or more of them.
So if you use [UIDevice identifierForVendor] and the user delete the app and reinstall it, the id will be different(so no real physical device tracking)
Why don't you use SecureUDID?
NSString *domain = #"com.example.app";
NSString *key = #"mykey";
NSString *udid = [SecureUDID UDIDForDomain:domain usingKey:key];
This way, even if the user delete the app and reinstall it, the UDID will be same. This will give you consistent tracking(or whatever you want to do with the UDID).
Btw, the above is still permitted from Apple.
Have fun.
The method for getting the UDID is being deprecated, you should now use CFUUIDCreate which I think could be used multiple times to get more identifiers if needed
Perhaps you should clarify your question.
requesting two (or even three) unique identifiers from the iPhone or iPad
…is a contradiction in terms. If your purpose is to track a specific physical device, then a single unique identifier, by definition, is enough. That’s what unique means.
Perhaps, what you really want is to track multiple things about each user’s use of your app, as opposed to the device. Say your networked game app allows the user 1, 2, or 3 different personalities. As they user creates a distinct personality, you must track each of that user's personalities amongst all the other user’s personalities.
For this kind of purpose, generating and storing a UUID* is a proper and common solution. iOS includes libraries to generate a UUID value. The only catch is that if the user deletes and re-installs the app, the storage of that UUID may be lost. There are workarounds for this challenge, which you may learn about by googling for discussions of replacing UDID tracking with generated UUID values.
This question is a bit older. So I should mention: In iOS 5, Apple deprecated the use of the UDID. As of 2013-05-01 Apple is rejecting any app that accesses the UDID.
(*) Do not confuse a UUID with a UDID. UUID is a standard 128-bit (32 hex digits) number often used as a virtually unique identifier in many technology scenarios. UDID is Apple's 40 hex digit string burned into every iOS device to uniquely identify each device.
DeviceCheck API in iOS 11 is an interesting solution to get unique Identifier, the advantage it has is - the value will be retained even after the app in uninstalled. So use cases like trial installation and rewards can be effectively controlled by developers.

Resources