c++ steam leaderboard Failure to write /read

Hello ,
First, I’m sorry for my bad English. But thanks in advance for reading and helping to answer

I call UpdateLeaderboardGameEnd () from gamehasended () at Playercontroller and WriteObject to the leaderboard .

I am trying to use the steam leaderboard and it works fine in the null sub-system!

However, using the steam subsystem will result in the following error:
I don`t know why, so I changed the constant value of leaderboard.h to StatName_StatName. But it still did not work

[2018.11.16-05.41.57:320][837]LogOnline: Warning: STEAM: Failure to read key value pair during retrieval from Steam MatchResults_Score
[2018.11.16-05.41.57:323][837]LogOnline: Warning: STEAM: Failure to read key value pair during retrieval from Steam MatchResults_Frags
[2018.11.16-05.41.57:324][837]LogOnline: Warning: STEAM: Failure to read key value pair during retrieval from Steam MatchResults_Deaths
[2018.11.16-05.41.57:324][837]LogOnline: Warning: STEAM: Failure to read key value pair during retrieval from Steam MatchResults_MatchesPlayed
[2018.11.16-05.41.57:627][856]LogOnline: Warning: STEAM: Failure to read key value pair during retrieval from Steam MatchResults_Score


[2018.11.16-05.41.57:628][856]LogOnline: Warning: STEAM: Failure to read key value pair during retrieval from Steam MatchResults_Frags
[2018.11.16-05.41.57:628][856]LogOnline: Warning: STEAM: Failure to read key value pair during retrieval from Steam MatchResults_Deaths
[2018.11.16-05.41.57:629][856]LogOnline: Warning: STEAM: Failure to read key value pair during retrieval from Steam MatchResults_MatchesPlayed

[2018.11.16-06.53.13:904][412]LogTemp: Warning: Found Subsystem STEAM
[2018.11.16-06.53.13:904][412]LogTemp: Warning: ResultsWriteObject works fined
[2018.11.16-06.53.13:905][412]LogTemp: Team org /pur Score: 3 ,0
[2018.11.16-06.53.14:421][445]LogOnline: Warning: STEAM: Failure to write key value pair when uploading to Steam MatchResults_Score=0
[2018.11.16-06.53.14:422][445]LogOnline: Warning: STEAM: Failure to write key value pair when uploading to Steam MatchResults_Frags=0
[2018.11.16-06.53.14:422][445]LogOnline: Warning: STEAM: Failure to write key value pair when uploading to Steam MatchResults_Deaths=0
[2018.11.16-06.53.14:422][445]LogOnline: Warning: STEAM: Failure to write key value pair when uploading to Steam MatchResults_MatchesPlayed=1
[2018.11.16-06.53.14:422][445]LogOnline: Warning: Async task 'FOnlineAsyncTaskSteamUpdateStats bWasSuccessful: 0 User: 'MySteamID^^' [0x1100001361F3613]' failed in 0.509878 seconds
[2018.11.16-06.53.14:422][445]LogOnline: Warning: Async task 'FOnlineAsyncTaskSteamUpdateLeaderboard bWasSuccessful: 0 Leaderboard: MatchResults Score: 0' failed in 0.517417 seconds

This is my build.cs file configuration

        PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine",  "OnlineSubsystem","OnlineSubsystemUtils","InputCore", "AIModule",
            /* Temporarily added GameplayTasks to workaround 4.12 compilation bug. */
            "GameplayTasks" ,"OnlineSubsystemSteam", "MoviePlayer"});
 PrivateDependencyModuleNames.AddRange(new string[] {"OnlineSubsystem","OnlineSubsystemSteam" });

This is my readerboard.h(interface for reading/writing data from/to a leaderboard) file

#include "OnlineLeaderboardInterface.h"


// these are normally exported from platform-specific tools
#define STATSCORE_STATSCORE				"Score_Score"
#define STATKILL_STATKILL				"Frags_Frags"
#define STATDEATHS_STATDEATHS				"Deaths_Deaths"
#define STATMATCHESPLAYED_STATMATCHESPLAYED		"MatchesPlayed_MatchesPlayed"

/*
	모든 리더보드 read object
*/
class FMatchResultsRead : public FOnlineLeaderboardRead
{
public:

	FMatchResultsRead()
	{
		// 디폴트 속성
		LeaderboardName = FName(TEXT("MatchResults"));
		SortedColumn = STATKILL_STATKILL;

		//디폴트 칼럼들 정의
		//점수
		new (ColumnMetadata) FColumnMetaData(STATSCORE_STATSCORE, EOnlineKeyValuePairDataType::Int32);
		//킬수
		new (ColumnMetadata) FColumnMetaData(STATKILL_STATKILL, EOnlineKeyValuePairDataType::Int32);
		//데스카운트
		new (ColumnMetadata) FColumnMetaData(STATDEATHS_STATDEATHS, EOnlineKeyValuePairDataType::Int32);
		new (ColumnMetadata) FColumnMetaData(STATMATCHESPLAYED_STATMATCHESPLAYED, EOnlineKeyValuePairDataType::Int32);
	}
};

/**
*		모든 리더보드 write object
*/
class FMatchResultsWrite : public FOnlineLeaderboardWrite
{
public:

	FMatchResultsWrite()
	{
		// Default properties
		new (LeaderboardNames) FName(TEXT("MatchResults"));
		//onlinestats.h 변수들
		RatedStat = STATSCORE_STATSCORE;
		DisplayFormat = ELeaderboardFormat::Number;
		SortMethod = ELeaderboardSort::Descending;
		UpdateMethod = ELeaderboardUpdateMethod::KeepBest;
		//표시방법, 기간
	}
};

this is my menu.cpp file

   //Button binding Function, It runs when I click the button.
   

 void UMainMenu::OpenLeaderBoardMenu()
    {
	if (!ensure(MenuSwitcher != nullptr)) return;
	
	LeaderboardReadCompleteDelegate = FOnLeaderboardReadCompleteDelegate::CreateUObject(this, &UMainMenu::OnStatsRead);
	if (LeaderBoardMenu)
	{
		//SetActiveWidget 의 매개변수로 UWidget이 필요하기에 멤버변수 선언 , JoinMenu를 액티브위젯으로 한다.
		MenuSwitcher->SetActiveWidget(LeaderBoardMenu);
	}
	ReadStatsLoginRequired();

	//ReadStats();

}

void UMainMenu::ReadStats()
{
	StatRows.Reset();

	IOnlineSubsystem* const OnlineSub = IOnlineSubsystem::Get();
	if (OnlineSub)
	{
		UE_LOG(LogTemp, Warning, TEXT("Found Subsystem %s"), *OnlineSub->GetSubsystemName().ToString());
		//리더보드 ptr얻음
		IOnlineLeaderboardsPtr Leaderboards = OnlineSub->GetLeaderboardsInterface();
		if (Leaderboards.IsValid())
		{
			UE_LOG(LogTemp, Warning, TEXT("Found Leaderboards isvalid"));
			//읽는 부분오류거나 onstatsRead에서 오류남
			//stats(통계)를 읽으려고함. The delegate will set this to false once the read is complete.
			LeaderboardReadCompleteDelegateHandle = Leaderboards->AddOnLeaderboardReadCompleteDelegate_Handle(LeaderboardReadCompleteDelegate);
			bReadingStats = true;

			//// There's no reason to request leaderboard requests while one is in progress, so only do it if there isn't one active.
			//if (!IsLeaderboardReadInProgress())
			//{
			ReadObject = MakeShareable(new FMatchResultsRead());
			FOnlineLeaderboardReadRef ReadObjectRef = ReadObject.ToSharedRef();
			//writeobject한것----> 내것과 친구플레이어 모두 읽기
			bReadingStats = Leaderboards->ReadLeaderboardsForFriends(0, ReadObjectRef);
			//}
		}

	}
}
/** 일부분의 리더보드 읽는데 호출된다 */
void UMainMenu::OnStatsRead(bool bWasSuccessful)
{
	UE_LOG(LogTemp, Warning, TEXT("OnStatsRead is called"));
	//if (!IsLeaderboardReadInProgress())
	//{
	ClearOnLeaderboardReadCompleteDelegate();

	if (bWasSuccessful)
	{
		UE_LOG(LogTemp, Warning, TEXT("OnStatsRead bWasSuccessful is true"));
		for (int Idx = 0; Idx < ReadObject->Rows.Num(); ++Idx)
		{
			//read 하는 과정에서 steam 플랫폼 사용하는것이 오류난다. null에서는 정상작동
			TSharedPtr<FLeaderboardsRow> NewLeaderboardRow = MakeShareable(new FLeaderboardsRow(ReadObject->Rows[Idx]));

			StatRows.Add(NewLeaderboardRow);
			UE_LOG(LogTemp, Warning, TEXT("StatRows.Add(NewLeaderboardRow);"));
		}
		//todo 리더보드에 추가
			SetLeaderBoardList(StatRows);

	}

	bReadingStats = false;
	//}
}

void UMainMenu::ClearOnLeaderboardReadCompleteDelegate()
{
	IOnlineSubsystem* OSS = IOnlineSubsystem::Get();
	if (OSS)
	{
		IOnlineLeaderboardsPtr Leaderboards = OSS->GetLeaderboardsInterface();
		if (Leaderboards.IsValid())
		{
			Leaderboards->ClearOnLeaderboardReadCompleteDelegate_Handle(LeaderboardReadCompleteDelegateHandle);
		}
	}
}

void UMainMenu::ReadStatsLoginRequired()
{
	if (!OnLoginCompleteDelegateHandle.IsValid())
	{
		IOnlineSubsystem* const OSS = IOnlineSubsystem::Get();
		if (OSS)
		{
			IOnlineIdentityPtr Identity = OSS->GetIdentityInterface();
			if (Identity.IsValid())
			{
				
				//login()함수가 호출되고나서 유저 로그인이 완료(성공/실패)되면 호출되는 델리게이트 
				OnLoginCompleteDelegateHandle = Identity->AddOnLoginCompleteDelegate_Handle(0, FOnLoginCompleteDelegate::CreateUObject(this, &UMainMenu::OnLoginCompleteReadStats));
				Identity->Login(0, FOnlineAccountCredentials());
				UE_LOG(LogTemp, Warning, TEXT("ReadStatsLoginRequired worked fine"));
			}
		}
	}
}
//ReadStatsLoginRequired에서 fire된 델리게이트
void UMainMenu::OnLoginCompleteReadStats(int32 LocalUserNum, bool bWasSuccessful, const FUniqueNetId& UserId, const FString& Error)
{
	UE_LOG(LogTemp, Warning, TEXT("OnLoginCompleteReadStats fired"));
	IOnlineSubsystem::Get()->GetIdentityInterface()->ClearOnLoginCompleteDelegate_Handle(LocalUserNum, OnLoginCompleteDelegateHandle);
	if (bWasSuccessful)
	{
		UE_LOG(LogTemp, Warning, TEXT("OnLoginCompleteReadStats delegate fired"));
		ReadStats();
	}
}

Hi car223,

Have you also configured your game to use Steam other than adding the Steam subsystem as a dependent module? (Does your DefaultEngine.ini contain [OnlineSubsystem] and [OnlineSubsystemSteam] config sections?)

yes !
This is my defaultEngine.ini setting for Steam.
I already saw the Steam overlay in my game

[/Script/Engine.GameEngine]
+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="OnlineSubsystemSteam.SteamNetDriver",DriverClassNameFallback="OnlineSubsystemUtils.IpNetDriver")

[OnlineSubsystem]
DefaultPlatformService=Steam

[OnlineSubsystemSteam]
bEnabled=true
SteamDevAppId=480

[Core.Log]
LogStreaming=Verbose
LogConfig=Verbose
LogProperty=Verbose

[/Script/OnlineSubsystemSteam.SteamNetDriver]
NetConnectionClassName="OnlineSubsystemSteam.SteamNetConnection"

Hi car223,

The leaderboard read/write isn’t working because you’re using the default app ID of 480. To be able to successfully add a leaderboard, you need to register an app with Steam to get a unique app ID and setup the leaderboard categories for your app.