UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
IOSAppDelegate.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#import <UIKit/UIKit.h>
6#import <GameKit/GKGameCenterViewController.h>
7
8#ifndef SWIFT_IMPORT
9#import <AVFoundation/AVAudioSession.h>
10#include "Delegates/Delegate.h"
11#include "Logging/LogMacros.h"
13#endif
14
15#if PLATFORM_VISIONOS
16#import <CompositorServices/CompositorServices.h>
17#else
18#import <UserNotifications/UserNotifications.h>
19#endif
20
21#define USE_MUTE_SWITCH_DETECTION 0
22
23#ifndef SWIFT_IMPORT
24
25#if !PLATFORM_TVOS
27#endif
28
29enum class EAudioFeature : uint8
30{
31 Playback, // Audio Not affected by the ringer switch
32 Record, // Recording only, unless Playback or VoiceChat is also set
33
34 DoNotMixWithOthers, // Do not mix audio with other applications
35
36 VoiceChat, // set AVAudioSessionModeVoiceChat when both Playback and Record are enabled
37 UseReceiver, // use receiver instead of speaker when both Playback and Record are enabled. Headsets will still be preferred if they are present
38 DisableBluetoothSpeaker, // disable the use of Bluetooth A2DP speakers when both Playback and Record are enabled
39
40 BluetoothMicrophone, // enable the use of Bluetooth HFP headsets when Record is enabled
41
42 BackgroundAudio, // continue to play audio in the background. Requires an appropriate background mode to be set in Info.plist
43
45};
46
49
50// Predicate to decide whether a push notification message should be processed
52
54{
55public:
56 // Broadcast when this application is opened from an external source.
59
61 static FDelegateHandle AddPushNotificationFilter(const FPushNotificationFilter& FilterDel);
62
64 static void RemovePushNotificationFilter(FDelegateHandle Handle);
65
67 static bool PassesPushNotificationFilters(NSDictionary* Payload);
68
72
76
77private:
78 struct FFilterDelegateAndHandle
79 {
82 };
83
84 static TArray<FFilterDelegateAndHandle> PushNotificationFilters;
85};
86
88
89@class IOSAppDelegate;
90
91namespace FAppEntry
92{
93 void PlatformInit();
95 void Init();
96 void Tick();
97 void SuspendTick();
98 void ResumeAudioContext();
100 void Shutdown();
101 void Suspend(bool bIsInterrupt = false);
102 void Resume(bool bIsInterrupt = false);
103 void RestartAudio();
106
108
112}
113
114#endif
115
116@class FIOSView;
117@class IOSViewController;
118
119#ifndef SWIFT_IMPORT
121#endif
122@interface IOSAppDelegate : UIResponder <
124#if !UE_BUILD_SHIPPING
126#endif
128#if !PLATFORM_VISIONOS
130#endif
132{
133 bool bForceExit;
135
137@property (strong, retain, nonatomic) UIWindow *Window;
139// support Compositor on other platforms?
140#if PLATFORM_VISIONOS
143#endif
144
146@property (retain) FIOSView* IOSView;
148#ifndef SWIFT_IMPORT
149@property class FIOSApplication* IOSApplication;
150#endif
151
153@property (retain) IOSViewController* IOSController;
156@property (retain) UIView* RootView;
159@property (assign) int AlertResponse;
162@property (readonly) float OSVersion;
164@property bool bDeviceInPortraitMode;
167@property (retain) UIViewController* viewController;
169@property (retain) NSTimer* timer;
171@property (retain) NSTimer* PeakMemoryTimer;
174@property (retain) NSTimer* IdleTimerEnableTimer;
177@property (readonly) float IdleTimerEnablePeriod;
179#if WITH_ACCESSIBILITY
184#endif
185
186// parameters passed from openURL
187@property (nonatomic, retain) NSMutableArray* savedOpenUrlParameters;
189#if !UE_BUILD_SHIPPING && !PLATFORM_TVOS
191 @property (nonatomic, retain) UIAlertController* ConsoleAlertController;
192 @property (nonatomic, retain) NSMutableArray* ConsoleHistoryValues;
193 @property (nonatomic, assign) int ConsoleHistoryValuesIndex;
194#endif
195
197@property (atomic) bool bEngineInit;
199@property (atomic) bool bPlatformInit;
201
203@property (retain) NSTimer* CommandLineParseTimer;
204@property (atomic) bool bCommandLineReady;
206#if !PLATFORM_TVOS
207@property (assign) UIInterfaceOrientation InterfaceOrientation;
208#endif
209
211@property (retain) NSDictionary* launchOptions;
213@property (assign) NSProcessInfoThermalState ThermalState;
214@property (assign) bool bBatteryState;
215@property (assign) int BatteryLevel;
217@property (assign) float ScreenScale; // UIScreen.scale
218@property (assign) float NativeScale; // UIWindow.screen.nativeScale
219@property (assign) float MobileContentScaleFactor;
220@property (assign) int RequestedResX;
221@property (assign) int RequestedResY;
222@property (assign) bool bUpdateAvailable;
223@property (retain) NSString* PendingActivationProtocol;
227+ (IOSAppDelegate*)GetDelegate;
228
229-(bool)IsIdleTimerEnabled;
230-(void)EnableIdleTimer:(bool)bEnable;
231-(void)StartGameThread;
232#ifndef SWIFT_IMPORT
235#endif
236-(void)NoUrlCommandLine;
237
238-(void)LoadScreenResolutionModifiers;
239
240-(int)GetAudioVolume;
241-(bool)AreHeadphonesPluggedIn;
242-(int)GetBatteryLevel;
243-(bool)IsRunningOnBattery;
244-(NSProcessInfoThermalState)GetThermalState;
245-(void)CheckForZoomAccessibility;
246-(float)GetBackgroundingMainThreadBlockTime;
248-(NSString*)GetPendingActivationProtocol;
250
251#if !PLATFORM_TVOS && !PLATFORM_VISIONOS && !defined(SWIFT_IMPORT)
256#endif
257
258#if !PLATFORM_TVOS && !PLATFORM_VISIONOS
259 +(void)UpdateSupportedInterfaceOrientations;
260#endif
261
262-(bool)IsUpdateAvailable;
263
264-(void) didRotate:(NSNotification*)notification;
265
266@property (assign) bool bAudioSessionInitialized;
269@property (assign) bool bUsingBackgroundMusic;
270@property (assign) bool bLastOtherAudioPlaying;
271@property (assign) bool bForceEmitOtherAudioPlaying;
273#if USE_MUTE_SWITCH_DETECTION
274@property (assign) bool bLastMutedState;
275@property (assign) bool bForceEmitMutedState;
276#endif
277
278@property (assign) float LastVolume;
279@property (assign) bool bForceEmitVolume;
281- (void)InitializeAudioSession;
282- (void)ToggleAudioSession:(bool)bActive;
283- (bool)IsBackgroundAudioPlaying;
284- (bool)HasRecordPermission;
285- (void)EnableVoiceChat:(bool)bEnable;
286- (void)EnableHighQualityVoiceChat:(bool)bEnable;
287- (bool)IsVoiceChatEnabled;
288
289#ifndef SWIFT_IMPORT
291- (void)SetFeature:(EAudioFeature)Feature Active:(bool)bIsActive;
293#endif
294
295@property (atomic) bool bAudioActive;
296@property (atomic) bool bVoiceChatEnabled;
298@property (atomic) bool bIsSuspended;
299@property (atomic) bool bHasSuspended;
300@property (atomic) bool bHasStarted;
301- (void)ToggleSuspend:(bool)bSuspend;
302
303- (void)ForceExit;
304
305static void interruptionListener(void* ClientData, UInt32 Interruption);
307-(UIWindow*)window;
308
309@end
310
OODEFFUNC typedef void(OODLE_CALLBACK t_fp_OodleCore_Plugin_Free)(void *ptr)
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
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define DECLARE_DELEGATE_RetVal_OneParam(ReturnValueType, DelegateName, Param1Type)
Definition DelegateCombinations.h:54
EDeviceScreenOrientation
Definition GenericPlatformMisc.h:236
FString LexToString(EAudioFeature Feature)
Definition IOSAppDelegate.cpp:200
EAudioFeature
Definition IOSAppDelegate.h:30
void InstallSignalHandlers()
Definition IOSAppDelegate.cpp:145
bool GIOSDelayRotationUntilPresent
Definition IOSAppDelegate.cpp:102
void LexFromString(EAudioFeature &OutFeature, const TCHAR *String)
Definition IOSAppDelegate.cpp:163
#define DECLARE_LOG_CATEGORY_EXTERN(CategoryName, DefaultVerbosity, CompileTimeVerbosity)
Definition LogMacros.h:361
const bool
Definition NetworkReplayStreaming.h:178
USkinnedMeshComponent float
Definition SkinnedMeshComponent.h:60
uint8_t uint8
Definition binka_ue_file_header.h:8
Definition IDelegateInstance.h:14
Definition IOSApplication.h:12
Definition IOSAppDelegate.h:54
static FOnWillResignActive OnWillResignActive
Definition IOSAppDelegate.h:71
static FOnOpenURL OnOpenURL
Definition IOSAppDelegate.h:58
DECLARE_MULTICAST_DELEGATE(FOnDidBecomeActive)
static FOnWillResignActive OnDidBecomeActive
Definition IOSAppDelegate.h:75
DECLARE_MULTICAST_DELEGATE_FourParams(FOnOpenURL, UIApplication *, NSURL *, NSString *, id)
DECLARE_MULTICAST_DELEGATE(FOnWillResignActive)
Definition IOSView.cpp:91
Definition IOSAppDelegate.cpp:247
bool bForceExit
Definition IOSAppDelegate.h:134
Definition IOSView.cpp:1091
Definition Array.h:670
Definition FunctionFwd.h:19
Definition IOSAppDelegate.h:92
FString gLaunchLocalNotificationActivationEvent
Definition LaunchIOS.cpp:607
void IncrementAudioSuspendCounters()
Definition LaunchIOS.cpp:274
int32 gLaunchLocalNotificationFireDate
Definition LaunchIOS.cpp:608
bool IsStartupMoviePlaying()
Definition LaunchIOS.cpp:387
void RestartAudio()
Definition LaunchIOS.cpp:245
void PreInit(IOSAppDelegate *AppDelegate, UIApplication *Application)
Definition LaunchIOS.cpp:304
void ResetAudioContextResumeTime()
Definition LaunchIOS.cpp:55
void DecrementAudioSuspendCounters()
Definition LaunchIOS.cpp:289
void Init()
Definition LaunchIOS.cpp:473
void ResumeAudioContext()
Definition LaunchIOS.cpp:217
void Suspend(bool bIsInterrupt=false)
Definition LaunchIOS.cpp:60
void SuspendTick()
Definition LaunchIOS.cpp:571
void PlatformInit()
Definition LaunchIOS.cpp:393
bool gAppLaunchedWithLocalNotification
Definition LaunchIOS.cpp:606
void Tick()
Definition LaunchIOS.cpp:552
void Shutdown()
Definition LaunchIOS.cpp:593