diff --git a/BREAKING-CHANGES.txt b/BREAKING-CHANGES.txt index 8f98892fd3..7145760625 100644 --- a/BREAKING-CHANGES.txt +++ b/BREAKING-CHANGES.txt @@ -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. diff --git a/modules/juce_core/native/juce_SystemStats_mac.mm b/modules/juce_core/native/juce_SystemStats_mac.mm index 078007d53d..2d643035a1 100644 --- a/modules/juce_core/native/juce_SystemStats_mac.mm +++ b/modules/juce_core/native/juce_SystemStats_mac.mm @@ -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 ""; } diff --git a/modules/juce_core/system/juce_SystemStats.h b/modules/juce_core/system/juce_SystemStats.h index 9d1704c9f3..777ce65b7d 100644 --- a/modules/juce_core/system/juce_SystemStats.h +++ b/modules/juce_core/system/juce_SystemStats.h @@ -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();