我开始使用虚幻引擎4进行iOS游戏。我试图将UIKit用作HUD的一部分。当我运行配置文件构建时,它失败并显示错误" Shell脚本调用错误' UIKit / UIAlertView.h'文件未找到"。
我的HUD类.h文件如下所示:
#pragma once
#include "GameFramework/HUD.h"
#include "BasicHUD.generated.h"
UCLASS()
class ABasicHUD : public AHUD
{
GENERATED_UCLASS_BODY()
UFUNCTION(BlueprintCallable , Category="Custom")
void ShowAlert();
};
我的HUD类.cpp文件如下所示:
#include "MyProject2.h"
#include "BasicHUD.h"
#import <UIKit/UIAlertView.h> // Error here: "Shell Script Invocation Error 'UIKit/UIAlertView.h' file not found"
ABasicHUD::ABasicHUD(const class FPostConstructInitializeProperties& PCIP)
: Super(PCIP)
{
}
void ABasicHUD::ShowAlert(){
NSString *string = [[NSString alloc]init];
UIAlertView *alert = [[UIAlertView alloc]init];
}
我的build.cs文件如下所示:
using UnrealBuildTool;
public class MyProject2 : ModuleRules
{
public MyProject2(TargetInfo Target)
{
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" });
if (Target.Platform == UnrealTargetPlatform.IOS)
{
PublicIncludePaths.AddRange(new string[] {"Runtime/Core/Public/Apple", "Runtime/Core/Public/IOS"});
AddThirdPartyPrivateStaticDependencies(Target, "zlib" );
PublicFrameworks.AddRange(new string[] { "UIKit", "Foundation", "AudioToolbox", "AVFoundation", "GameKit", "StoreKit", "CoreVideo", "CoreMedia", "CoreMotion"});
bool bSupportAdvertising = true;
if (bSupportAdvertising)
{
PublicFrameworks.AddRange(new string[] { "iAD", "CoreGraphics" });
}
}
}
}
我认为我必须在build.cs文件中做错了,但我不确定为什么它找不到框架。如何使用虚幻构建工具找到UIKit?