UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
IOSPlatformMisc.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3/*=============================================================================================
4 IOSPlatformMisc.h: iOS platform misc functions
5==============================================================================================*/
6
7#pragma once
11
12template <typename FuncType>
13class TFunction;
14
16
17template <typename FuncType, typename UserPolicy>
19
24{
25 static void PlatformPreInit();
26 static void PlatformInit();
27 static void PlatformHandleSplashScreen(bool ShowSplashScreen = false);
29
31 {
32 return IOS_MAX_PATH;
33 }
34
36 {
37 return false;
38 }
39
41 static void SetMemoryWarningHandler(void (* Handler)(const FGenericMemoryWarningContext& Context));
42 static bool HasMemoryWarningHandler();
43 static bool HasPlatformFeature(const TCHAR* FeatureName);
44 static bool SetStoredValue(const FString& InStoreId, const FString& InSectionName, const FString& InKeyName, const FString& InValue);
45 static bool GetStoredValue(const FString& InStoreId, const FString& InSectionName, const FString& InKeyName, FString& OutValue);
46 static bool DeleteStoredValue(const FString& InStoreId, const FString& InSectionName, const FString& InKeyName);
47 static bool DeleteStoredSection(const FString& InStoreId, const FString& InSectionName);
48 static void GetValidTargetPlatforms(class TArray<class FString>& TargetPlatformNames);
50 static bool HasActiveWiFiConnection();
51 static const TCHAR* GamePersistentDownloadDir();
53
54 static void RequestExit(bool Force, const TCHAR* CallSite = nullptr);
55 static void RequestExitWithStatus(bool Force, uint8 ReturnCode, const TCHAR* CallSite = nullptr);
56
57 UE_DEPRECATED(4.21, "Use GetDeviceVolume, it is now callable on all platforms.")
58 static int GetAudioVolume();
59
60 static bool AreHeadphonesPluggedIn();
61 static int GetBatteryLevel();
62 static bool IsRunningOnBattery();
63 static float GetDeviceTemperatureLevel();
64 static EDeviceScreenOrientation GetDeviceOrientation();
65 UE_DEPRECATED(5.1, "SetDeviceOrientation is deprecated. Use SetAllowedDeviceOrientation instead.")
66 static void SetDeviceOrientation(EDeviceScreenOrientation NewDeviceOrientation);
67 static void SetAllowedDeviceOrientation(EDeviceScreenOrientation NewAllowedDeviceOrientation);
68 static int32 GetDeviceVolume();
69 static void SetBrightness(float Brightness);
70 static float GetBrightness();
71 static bool SupportsBrightness() { return true; }
72 static bool IsInLowPowerMode();
73
74 // These two functions can be used to see if we're in designed for ipad mode explicltly
75 // on vision os or mac. This check may not be valid in the future, but will do the trick for now
76 static bool IsDesignedForIpadOnVisionOS();
77 static bool IsDesignedForIpadOnMacOS();
78
83 // Check if notifications are allowed if min iOS version is < 10
84 UE_DEPRECATED(4.21, "IsAllowedRemoteNotifications is deprecated. Use FIOSLocalNotificationService::CheckAllowedNotifications instead.")
85 static bool IsAllowedRemoteNotifications();
86
96 static EIOSAuthNotificationStatus GetNotificationAuthorizationStatus();
97
98 static FString GetPendingActivationProtocol();
99
100 static bool IsEntitlementEnabled(const char *EntitlementToCheck);
101
103
104 static bool SupportsForceTouchInput();
105
107 static void TriggerMobileHaptics();
108 static void ReleaseMobileHaptics();
109
110 static void ShareURL(const FString& URL, const FText& Description, int32 LocationHintX, int32 LocationHintY);
111
112 static FString LoadTextFileFromPlatformPackage(const FString& RelativePath);
113 static bool FileExistsInPlatformPackage(const FString& RelativePath);
114
115 static void EnableVoiceChat(bool bEnable);
116 static bool IsVoiceChatEnabled();
117 static bool HasRecordPermission();
118
120 static int GetDefaultStackSize();
121 static void HandleLowMemoryWarning();
122 static bool IsPackagedForDistribution();
127 static FString GetDeviceId();
128 static FString GetOSVersion();
129 static FString GetUniqueAdvertisingId();
130
131 // bInIncludeFreeable determines whether to use the "Important" iOS free space value or the actual free space (Capacity).
132 // The "Important" value is almost certainly what you want - but it's slow (upwards of 100ms).
134
135 static void RequestStoreReview();
136
137 static bool IsUpdateAvailable();
138
139 // GetIOSDeviceType is deprecated in 4.26 and is no longer updated. See below.
207
208 UE_DEPRECATED(4.26, "Use GetDefaultDeviceProfileName() which uses the [IOSDeviceMappings] entries in BaseDeviceProfiles.ini and can be updated to support newly released devices.")
209 static EIOSDevice GetIOSDeviceType();
210
211 static const TCHAR* GetDefaultDeviceProfileName();
212
213 static FString GetCPUVendor();
214 static FString GetCPUBrand();
215 static void GetOSVersions(FString& out_OSVersionLabel, FString& out_OSSubVersionLabel);
216 static int32 IOSVersionCompare(uint8 Major, uint8 Minor, uint8 Revision);
217 static FString GetProjectVersion();
218 static FString GetBuildNumber();
219
223 static bool IsBackgroundAppRefreshAvailable();
224
228 static void OpenAppNotificationSettings();
229
233 static void OpenAppCustomSettings();
234
235 static void SetGracefulTerminationHandler();
236 static void SetCrashHandler(void(*CrashHandler)(const FGenericCrashContext& Context));
237
238 static bool SupportsDeviceCheckToken()
239 {
240 return true;
241 }
242
243 static bool RequestDeviceCheckToken(TFunction<void(const TArray<uint8>&)> QuerySucceededFunc, TFunction<void(const FString&, const FString&)> QueryFailedFunc);
244
245 // Information about the properties of the network that a connection uses.
247 {
248 // Indndicating whether the used network interface has a DNS server configured.
249 bool bSupportsDNS : 1 = false;
250 // Indicating whether the used network interface can route IPv4 traffic.
251 bool bSupportsIPv4 : 1 = false;
252 // Indicating whether the used network interface can route IPv6 traffic.
253 bool bSupportsIPv6 : 1 = false;
254 // Indicating whether the used network interface is in Low Data Mode.
255 // It is applicable to both WiFi & cellular connections.
256 bool bIsConstrained : 1 = false;
257 // Indicating whether the used network interface is considered
258 // expensive, such as cellular or a personal hotspot.
259 bool bIsExpensive : 1 = false;
260 };
261 // Thread-safe even that is fired from a task-thread.
262 static TMulticastDelegateRegistration<void(FNetworkConnectionCharacteristics), FDefaultTSDelegateUserPolicy>& OnNetworkConnectionCharacteristicsChanged();
263
265 {
266 // Linear output to Apple's specific format.
269 }
270
271 static int32 GetMaxRefreshRate();
272
273 // added these for now because Crashlytics doesn't properly break up different callstacks all ending in UE_LOG(LogXXX, Fatal, ...)
274 static FORCENOINLINE CA_NO_RETURN void GPUAssert();
275 static FORCENOINLINE CA_NO_RETURN void MetalAssert();
276
277 static bool CPUHasHwCrcSupport();
278 static bool CPUHasHwAesSupport();
279
280 static FString GetDiscardableCacheDir();
281
282#if !UE_BUILD_SHIPPING
283 static bool IsConsoleOpen();
284#endif
285
286 static const class TMap<FString, FString>& GetConfigRuleVars();
287};
288
OODEFFUNC typedef void(OODLE_CALLBACK t_fp_OodleCore_Plugin_Free)(void *ptr)
#define FORCENOINLINE
Definition AndroidPlatform.h:142
#define FORCEINLINE
Definition AndroidPlatform.h:140
#define CA_NO_RETURN
Definition CoreMiscDefines.h:124
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
FPlatformTypes::TCHAR TCHAR
Either ANSICHAR or WIDECHAR, depending on whether the platform supports wide characters or the requir...
Definition Platform.h:1135
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
FPlatformTypes::uint64 uint64
A 64-bit unsigned integer.
Definition Platform.h:1117
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
@ Major
Major version increments introduce breaking API changes.
@ Minor
Minor version increments add additional functionality without breaking existing APIs.
EDeviceScreenOrientation
Definition GenericPlatformMisc.h:236
EDisplayColorGamut
Definition GenericPlatformMisc.h:518
EDisplayOutputFormat
Definition GenericPlatformMisc.h:499
EMobileHapticsType
Definition GenericPlatformMisc.h:357
ENetworkConnectionType
Definition GenericPlatformMisc.h:383
#define IOS_MAX_PATH
Definition IOSCommandLineHelper.h:8
FIOSPlatformMisc FPlatformMisc
Definition IOSPlatformMisc.h:289
uint8_t uint8
Definition binka_ue_file_header.h:8
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition UnrealType.h:3087
Definition Text.h:385
Definition GenericPlatformChunkInstall.h:129
Definition Array.h:670
Definition AndroidPlatformMisc.h:14
Definition UnrealString.h.inl:34
Definition DelegateSignatureImpl.inl:725
Type
Definition GenericPlatformMisc.h:306
Type
Definition GenericPlatformMisc.h:325
Definition ApplePlatformMisc.h:56
static void PlatformInit()
Definition DelegateBase.h:163
Definition GenericPlatformCrashContext.h:395
Definition GenericPlatformCrashContext.h:899
static CORE_API FString LoadTextFileFromPlatformPackage(const FString &RelativePath)
Definition GenericPlatformMisc.cpp:2009
static void ReleaseMobileHaptics()
Definition GenericPlatformMisc.h:1810
static bool HasMemoryWarningHandler()
Definition GenericPlatformMisc.h:889
static CORE_API FString GetUniqueAdvertisingId()
Definition GenericPlatformMisc.cpp:595
static bool HasPlatformFeature(const TCHAR *FeatureName)
Definition GenericPlatformMisc.h:1639
static CORE_API bool GetStoredValue(const FString &InStoreId, const FString &InSectionName, const FString &InKeyName, FString &OutValue)
Definition GenericPlatformMisc.cpp:880
static CORE_API bool SetStoredValue(const FString &InStoreId, const FString &InSectionName, const FString &InKeyName, const FString &InValue)
Definition GenericPlatformMisc.cpp:864
static bool SupportsForceTouchInput()
Definition GenericPlatformMisc.h:1554
static CORE_API bool RequestDeviceCheckToken(TFunction< void(const TArray< uint8 > &)> QuerySucceededFunc, TFunction< void(const FString &, const FString &)> QueryFailedFunc)
Definition GenericPlatformMisc.cpp:2003
static const TCHAR * GetPlatformFeaturesModuleName()
Definition GenericPlatformMisc.h:1212
static bool IsPackagedForDistribution()
Definition GenericPlatformMisc.h:1334
static CORE_API const TCHAR * GamePersistentDownloadDir()
Definition GenericPlatformMisc.cpp:1495
static CORE_API void GetValidTargetPlatforms(TArray< FString > &TargetPlatformNames)
Definition GenericPlatformMisc.cpp:1739
static FORCEINLINE bool IsInLowPowerMode()
Definition GenericPlatformMisc.h:1502
static CORE_API void RequestExitWithStatus(bool Force, uint8 ReturnCode, const TCHAR *CallSite=nullptr)
Definition GenericPlatformMisc.cpp:1008
static CORE_API EAppReturnType::Type MessageBoxExt(EAppMsgType::Type MsgType, const TCHAR *Text, const TCHAR *Caption)
Definition GenericPlatformMisc.cpp:1105
static CORE_API void PlatformPreInit()
Definition GenericPlatformMisc.cpp:1970
static CORE_API void RegisterForRemoteNotifications()
Definition GenericPlatformMisc.cpp:1981
static CORE_API IPlatformChunkInstall * GetPlatformChunkInstall()
Definition GenericPlatformMisc.cpp:1294
static CORE_API FString GetPendingActivationProtocol()
Definition GenericPlatformMisc.cpp:1997
static CORE_API void RequestExit(bool Force, const TCHAR *CallSite=nullptr)
Definition GenericPlatformMisc.cpp:978
static CORE_API FString GetOSVersion()
Definition GenericPlatformMisc.cpp:732
static void PlatformHandleSplashScreen(bool ShowSplashScreen=false)
Definition GenericPlatformMisc.h:575
static CORE_API bool HasSeparateChannelForDebugOutput()
Definition GenericPlatformMisc.cpp:973
static CORE_API void UnregisterForRemoteNotifications()
Definition GenericPlatformMisc.cpp:1992
static int32 GetMaxRefreshRate()
Definition GenericPlatformMisc.h:1901
static CORE_API bool GetDiskTotalAndFreeSpace(const FString &InPath, uint64 &TotalNumberOfBytes, uint64 &NumberOfFreeBytes)
Definition GenericPlatformMisc.cpp:737
static ENetworkConnectionType GetNetworkConnectionType()
Definition GenericPlatformMisc.h:1620
static void SetMemoryWarningHandler(void(*Handler)(const FGenericMemoryWarningContext &Context))
Definition GenericPlatformMisc.h:882
static CORE_API bool FileExistsInPlatformPackage(const FString &RelativePath)
Definition GenericPlatformMisc.cpp:2022
static bool HasActiveWiFiConnection()
Definition GenericPlatformMisc.h:1602
static void TriggerMobileHaptics()
Definition GenericPlatformMisc.h:1803
static CORE_API const class TMap< FString, FString > & GetConfigRuleVars()
Definition GenericPlatformMisc.cpp:2158
static CORE_API FString GetDeviceId()
Definition GenericPlatformMisc.cpp:589
static CORE_API bool DeleteStoredSection(const FString &InStoreId, const FString &InSectionName)
Definition GenericPlatformMisc.cpp:915
static CORE_API bool DeleteStoredValue(const FString &InStoreId, const FString &InSectionName, const FString &InKeyName)
Definition GenericPlatformMisc.cpp:895
static void ShareURL(const FString &URL, const FText &Description, int32 LocationHintX, int32 LocationHintY)
Definition GenericPlatformMisc.h:1817
static void PrepareMobileHaptics(EMobileHapticsType Type)
Definition GenericPlatformMisc.h:1795
static CORE_API bool IsRegisteredForRemoteNotifications()
Definition GenericPlatformMisc.cpp:1986
bool bSupportsIPv4
Definition IOSPlatformMisc.h:251
bool bIsExpensive
Definition IOSPlatformMisc.h:259
bool bIsConstrained
Definition IOSPlatformMisc.h:256
bool bSupportsIPv6
Definition IOSPlatformMisc.h:253
bool bSupportsDNS
Definition IOSPlatformMisc.h:249
Definition IOSPlatformMisc.h:24
static FORCEINLINE constexpr int32 GetMaxPathLength()
Definition IOSPlatformMisc.h:30
EIOSDevice
Definition IOSPlatformMisc.h:141
@ IOS_IPadPro_11
Definition IOSPlatformMisc.h:182
@ IOS_IPhoneXSMax
Definition IOSPlatformMisc.h:176
@ IOS_IPadMini
Definition IOSPlatformMisc.h:152
@ IOS_IPadMini2
Definition IOSPlatformMisc.h:153
@ IOS_IPadPro4_129
Definition IOSPlatformMisc.h:190
@ IOS_AppleTV4K
Definition IOSPlatformMisc.h:168
@ IOS_NewDevice6
Definition IOSPlatformMisc.h:199
@ IOS_IPodTouch5
Definition IOSPlatformMisc.h:147
@ IOS_IPhone8Plus
Definition IOSPlatformMisc.h:164
@ IOS_IPadPro_97
Definition IOSPlatformMisc.h:171
@ IOS_IPadPro3_129
Definition IOSPlatformMisc.h:183
@ IOS_IPadMini4
Definition IOSPlatformMisc.h:154
@ IOS_AppleTV
Definition IOSPlatformMisc.h:167
@ IOS_IPhoneXS
Definition IOSPlatformMisc.h:175
@ IOS_IPhone6
Definition IOSPlatformMisc.h:157
@ IOS_NewDevice1
Definition IOSPlatformMisc.h:194
@ IOS_IPadPro2_11
Definition IOSPlatformMisc.h:189
@ IOS_IPhone11
Definition IOSPlatformMisc.h:178
@ IOS_NewDevice3
Definition IOSPlatformMisc.h:196
@ IOS_IPadPro
Definition IOSPlatformMisc.h:166
@ IOS_IPhone6SPlus
Definition IOSPlatformMisc.h:160
@ IOS_IPad4
Definition IOSPlatformMisc.h:151
@ IOS_IPodTouch7
Definition IOSPlatformMisc.h:186
@ IOS_IPhoneSE
Definition IOSPlatformMisc.h:169
@ IOS_IPad7
Definition IOSPlatformMisc.h:187
@ IOS_IPadMini5
Definition IOSPlatformMisc.h:185
@ IOS_NewDevice5
Definition IOSPlatformMisc.h:198
@ IOS_IPad5
Definition IOSPlatformMisc.h:174
@ IOS_NewDevice8
Definition IOSPlatformMisc.h:201
@ IOS_IPhone5S
Definition IOSPlatformMisc.h:146
@ IOS_IPhoneXR
Definition IOSPlatformMisc.h:177
@ IOS_IPhone8
Definition IOSPlatformMisc.h:163
@ IOS_IPhone5
Definition IOSPlatformMisc.h:145
@ IOS_IPhoneSE2
Definition IOSPlatformMisc.h:188
@ IOS_IPadPro_105
Definition IOSPlatformMisc.h:172
@ IOS_NewDevice7
Definition IOSPlatformMisc.h:200
@ IOS_IPadAir3
Definition IOSPlatformMisc.h:184
@ IOS_NewDevice4
Definition IOSPlatformMisc.h:197
@ IOS_IPhone11ProMax
Definition IOSPlatformMisc.h:180
@ IOS_IPhone11Pro
Definition IOSPlatformMisc.h:179
@ IOS_IPhone4S
Definition IOSPlatformMisc.h:144
@ IOS_IPhoneX
Definition IOSPlatformMisc.h:165
@ IOS_IPadPro2_129
Definition IOSPlatformMisc.h:173
@ IOS_NewDevice2
Definition IOSPlatformMisc.h:195
@ IOS_IPad3
Definition IOSPlatformMisc.h:150
@ IOS_IPhone6S
Definition IOSPlatformMisc.h:159
@ IOS_IPodTouch6
Definition IOSPlatformMisc.h:148
@ IOS_RealityPro
Definition IOSPlatformMisc.h:203
@ IOS_IPadAir
Definition IOSPlatformMisc.h:155
@ IOS_IPhone6Plus
Definition IOSPlatformMisc.h:158
@ IOS_IPad2
Definition IOSPlatformMisc.h:149
@ IOS_Unknown
Definition IOSPlatformMisc.h:205
@ IOS_IPhone4
Definition IOSPlatformMisc.h:143
@ IOS_IPadPro_129
Definition IOSPlatformMisc.h:170
@ IOS_IPhone7
Definition IOSPlatformMisc.h:161
@ IOS_IPhone7Plus
Definition IOSPlatformMisc.h:162
@ IOS_IPad6
Definition IOSPlatformMisc.h:181
@ IOS_IPadAir2
Definition IOSPlatformMisc.h:156
EIOSAuthNotificationStatus
Definition IOSPlatformMisc.h:88
@ Provisional
Definition IOSPlatformMisc.h:92
@ NotDetermined
Definition IOSPlatformMisc.h:89
@ Ephemeral
Definition IOSPlatformMisc.h:93
@ Authorized
Definition IOSPlatformMisc.h:91
@ Denied
Definition IOSPlatformMisc.h:90
static bool AllowThreadHeartBeat()
Definition IOSPlatformMisc.h:35
static FORCEINLINE void ChooseHDRDeviceAndColorGamut(uint32 DeviceId, uint32 DisplayNitLevel, EDisplayOutputFormat &OutputDevice, EDisplayColorGamut &ColorGamut)
Definition IOSPlatformMisc.h:264