mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-02-05 03:50:07 +00:00
SystemStats: Use 'identifierForVendor' for iOS device ID generation
This commit is contained in:
parent
c398ab065f
commit
ebfe9b403b
3 changed files with 40 additions and 1 deletions
|
|
@ -4,6 +4,30 @@ JUCE breaking changes
|
|||
develop
|
||||
=======
|
||||
|
||||
Change
|
||||
------
|
||||
Unique device IDs on iOS now use the OS provided 'identifierForVendor'.
|
||||
OnlineUnlockStatus has been updated to handle the iOS edge-case where a device
|
||||
ID query might return an empty String.
|
||||
|
||||
Possible Issues
|
||||
---------------
|
||||
The License checks using InAppPurchases, getLocalMachineIDs(), and
|
||||
getUniqueDeviceID() may return an empty String if iOS 'is not ready'. This can
|
||||
occur for example if the device has restarted but has not yet been unlocked.
|
||||
|
||||
Workaround
|
||||
----------
|
||||
InAppPurchase has been updated to handle this and propagate the error
|
||||
accordingly. The relevant methods have been updated to return a Result object
|
||||
that can be queried for additional information on failure.
|
||||
|
||||
Rationale
|
||||
---------
|
||||
Apple have introduced restrictions on device identification rendering our
|
||||
previous methods unsuitable.
|
||||
|
||||
|
||||
Change
|
||||
------
|
||||
AudioProcessor::getAAXPluginIDForMainBusConfig() has been deprecated.
|
||||
|
|
|
|||
|
|
@ -351,6 +351,7 @@ int SystemStats::getPageSize()
|
|||
|
||||
String SystemStats::getUniqueDeviceID()
|
||||
{
|
||||
#if JUCE_MAC
|
||||
constexpr mach_port_t port = 0;
|
||||
|
||||
const auto dict = IOServiceMatching ("IOPlatformExpertDevice");
|
||||
|
|
@ -363,6 +364,14 @@ String SystemStats::getUniqueDeviceID()
|
|||
if (CFGetTypeID (uuidTypeRef.get()) == CFStringGetTypeID())
|
||||
return String::fromCFString ((CFStringRef) uuidTypeRef.get()).removeCharacters ("-");
|
||||
}
|
||||
#elif JUCE_IOS
|
||||
JUCE_AUTORELEASEPOOL
|
||||
{
|
||||
if (UIDevice* device = [UIDevice currentDevice])
|
||||
if (NSUUID* uuid = [device identifierForVendor])
|
||||
return nsStringToJuce ([uuid UUIDString]);
|
||||
}
|
||||
#endif
|
||||
|
||||
return "";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -153,7 +153,13 @@ public:
|
|||
changes.
|
||||
|
||||
This ID will be invalidated by changes to the motherboard and CPU on non-mobile
|
||||
platforms, or resetting an Android device.
|
||||
platforms, or performing a system restore on an Android device.
|
||||
|
||||
There are some extra caveats on iOS: The returned ID is unique to the vendor part of
|
||||
your 'Bundle Identifier' and is stable for all associated apps. The key is invalidated
|
||||
once all associated apps are uninstalled. This function can return an empty string
|
||||
under certain conditions, for example, If the device has not been unlocked since a
|
||||
restart.
|
||||
*/
|
||||
static String getUniqueDeviceID();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue