1

我已经开始为 iOS 游戏使用虚幻引擎 4。我正在尝试将 UIKit 用作 HUD 的一部分。当我运行配置文件构建时,它失败并显示错误“Shell Script Invocation Error 'UIKit/UIAlertView.h' file not found”。

我的 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?

4

0 回答 0