언리얼 엔진에서 외부 웹사이트를 여는 대표적인 방법은 UKismetSystemLibrary::LaunchURL
함수를 사용하는 것입니다. 이 함수는 블루프린트에서도 쉽게 사용할 수 있어, 게임 내에서 외부 링크로 사용자를 유도할 때 매우 유용합니다.
📌 UKismetSystemLibrary::LaunchURL의 내부 동작
UKismetSystemLibrary::LaunchURL
은 내부적으로 FPlatformProcess::LaunchURL
을 호출합니다. 그리고 플랫폼 별로 실제 동작은 FGenericPlatformProcess
를 기반으로 각각의 OS에 맞는 구현체가 실행됩니다.
언리얼 엔진에서 FGenericPlatformProcess::LaunchURL
를 이용해 iOS에서 외부 브라우저로 이동하려 할 때, iOS 18부터는 동작하지 않는 문제가 발생합니다. 이는 Apple이 기존의 UIApplication::openURL:
메서드를 더 이상 지원하지 않기 때문입니다.
수정할 함수는 다음과 같습니다:void FIOSPlatformProcess::LaunchURL(const TCHAR* URL, const TCHAR* Parms, FString* Error)
📌 문제 요약
LaunchURL()
함수는UIApplication::openURL:
API를 사용- iOS 18부터 해당 API는 Deprecated
- 새로운 API인
openURL:options:completionHandler:
로 대체 필요
🧩 수정 대상 코드
파일 경로: Engine/Source/Runtime/Core/Private/IOS/IOSPlatformProcess.cpp
🔸 기존 코드 (문제 발생)
NSString* CFUrl = (NSString*)FPlatformString::TCHARToCFString(URL);
PRAGMA_DISABLE_DEPRECATION_WARNINGS
bool Result = [[UIApplication sharedApplication] openURL: [NSURL URLWithString: CFUrl]];
PRAGMA_ENABLE_DEPRECATION_WARNINGS
✅ 수정 코드 (iOS 10 이상 API 사용)
NSString* CFUrl = (NSString*)FPlatformString::TCHARToCFString(URL);
PRAGMA_DISABLE_DEPRECATION_WARNINGS
bool Result = false;
if (@available(iOS 10.0, *)) {
Result = true;
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:CFUrl] options:@{} completionHandler:nil];
} else {
Result = [[UIApplication sharedApplication] openURL:[NSURL URLWithString:CFUrl]];
}
PRAGMA_ENABLE_DEPRECATION_WARNINGS
🛠 전체 함수 수정 예시
void FIOSPlatformProcess::LaunchURL(const TCHAR* URL, const TCHAR* Parms, FString* Error)
{
#if PLATFORM_VISIONOS
*Error = TEXT("LaunchURL is not supported on VisionOS");
#else
UE_LOG(LogIOS, Log, TEXT("LaunchURL %s %s"), URL, Parms ? Parms : TEXT(""));
if (FCoreDelegates::ShouldLaunchUrl.IsBound() && !FCoreDelegates::ShouldLaunchUrl.Execute(URL))
{
if (Error)
{
*Error = TEXT("LaunchURL cancelled by delegate");
}
return;
}
NSString* CFUrl = (NSString*)FPlatformString::TCHARToCFString(URL);
PRAGMA_DISABLE_DEPRECATION_WARNINGS
bool Result = false;
if (@available(iOS 10.0, *)) {
Result = true;
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:CFUrl] options:@{} completionHandler:nil];
} else {
Result = [[UIApplication sharedApplication] openURL:[NSURL URLWithString:CFUrl]];
}
PRAGMA_ENABLE_DEPRECATION_WARNINGS
if (Error != nullptr)
{
*Error = Result ? TEXT("") : TEXT("unable to open url");
}
#endif
}
📄 결론
iOS 18 이상 환경에서는 UIApplication::openURL:
API가 더 이상 지원되지 않기 때문에, 언리얼 엔진 내부 LaunchURL()
함수에 새로운 API를 적용해야 합니다. 위와 같이 수정하면 외부 링크 호출이 iOS 18에서도 정상 작동합니다. 해당 코드는 엔진 소스 자체를 수정해야 하므로, GitHub에서 포크하거나 소스 빌드 환경에서 적용하는 것이 좋습니다.
🔗 참고 공식 문서
'Unreal Engine' 카테고리의 다른 글
언리얼 블루프린트 vs C++ 뭐가 더 좋을까? (초보 개발자 필독 비교 가이드) (1) | 2025.05.06 |
---|---|
Paused 상태에서도 Tick이 가능? (FTickableGameObject 활용법, Tick 우회, 게임정지 대응) (2) | 2025.05.06 |
FDateTime 완전정복 (UTCNow, UnixTime, Timeout, 문자열 포맷) (2) | 2025.05.04 |
언리얼 델리게이트 완전정복 (Single, Multicast, Dynamic, Event, Params) (0) | 2025.05.03 |
UE 초보 개발자를 위한 FString 완전정복 (0) | 2025.05.02 |