# \[EOS SDK Apple\]: Error when setting EOS\_Connect\_UserLoginInfo.ApiVersion to EOS\_CONNECT\_USERLOGININFO\_API\_LATEST

**URL:** <https://forums.unrealengine.com/t/eos-sdk-apple-error-when-setting-eos-connect-userlogininfo-apiversion-to-eos-connect-userlogininfo-api-latest/2124985>\
**Category:** C++\
**Tags:** unreal-engine, question\
**Created:** [November 15, 2024, 3:32pm UTC](https://forums.unrealengine.com/t/eos-sdk-apple-error-when-setting-eos-connect-userlogininfo-apiversion-to-eos-connect-userlogininfo-api-latest/2124985 "2024-11-15T15:32:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![v.falcon.fishlab](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@v.falcon.fishlab](https://forums.unrealengine.com/u/v.falcon.fishlab)\
**Post date:** [November 15, 2024, 3:32pm UTC](https://forums.unrealengine.com/t/eos-sdk-apple-error-when-setting-eos-connect-userlogininfo-apiversion-to-eos-connect-userlogininfo-api-latest/2124985/1 "2024-11-15T15:32:49Z")

</div>

Hello,  
We have been trying to make GameCenter (Apple’s internal game service for multiplayer) to work with EOS. We got so far that everything seems to be correct but when trying to login with `EOS_Connect_Login` it triggers the following error `LogOnlineEOSSDK: Error: [EOS_SDK]: [LogEOSConnect]:Incompatible EOS_Connect_UserLoginInfo version specified (1225075024), expected range (1 to 2)` we are setting up the version using `EOS_CONNECT_USERLOGININFO_API_LATEST` as stated on the [docs](https://dev.epicgames.com/docs/en-US/api-ref/structs/eos-connect-user-login-info) but this issue is persistent. Just to be clear `EOS_Connect_UserLoginInfo` is needed for the function as stated in the [docs](https://dev.epicgames.com/docs/api-ref/structs/eos-connect-login-options) for Apple. We have also tried to set the value to 1 or 2 manually but the same error happens. I think the issue has to do with some lost of data when sending the values to the function. Any idea of what could be happening here?  
The following code uses EOS SDK 1.16.0 and UE 4.25-Plus

```auto
void FOnlineIdentityEOS::ConnectLogin(int32 LocalUserNum, const FOnConnectLoginCompleteDelegate& Delegate, bool ForcePlatformToken)
{
// Code .....
std::string Token{ TCHAR_TO_UTF8(*PlatformToken) };
                EOS_Connect_Credentials Credentials{};
                Credentials.ApiVersion = EOS_CONNECT_CREDENTIALS_API_LATEST;
                Credentials.Token = Token.c_str();
                Credentials.Type = ConvertAuthType(PlatformTokenType);

            EOS_Connect_LoginOptions Options{};
            Options.ApiVersion = EOS_CONNECT_LOGIN_API_LATEST;
            Options.Credentials = &Credentials;
#if PLATFORM_MAC
                if(EOSSubsystem->UseGameCenterAuth())
                {
                    EOS_Connect_UserLoginInfo UserLoginInfo{};
                    UserLoginInfo.ApiVersion = EOS_CONNECT_USERLOGININFO_API_LATEST;

                    UE_LOG_ONLINE_IDENTITY(Log, TEXT("[EOS] Connect login API version [%i]"), UserLoginInfo.ApiVersion);

                    IOnlineIdentityPtr OnlineIdentityInterface = IOnlineSubsystem::Get(MAC_SUBSYSTEM)->GetIdentityInterface();
                    if (OnlineIdentityInterface.IsValid())
                    {
                        FString PlayerNickName = OnlineIdentityInterface->GetPlayerNickname(LocalUserNum);
                        std::string DisplayName {TCHAR_TO_UTF8(*PlayerNickName)};
                        UserLoginInfo.DisplayName = DisplayName.c_str();

                        UE_LOG_ONLINE_IDENTITY(Log, TEXT("[EOS] Connect login setting display name [%s]"), UserLoginInfo.DisplayName);
                    }
                    else
                    {
                        UE_LOG_ONLINE_IDENTITY(Error, TEXT("[EOS] Connect login for user failed to get Online identity interface for Mac auth token"));
                    }
                    Options.UserLoginInfo = &UserLoginInfo;
                }
                else
                {
                    Options.UserLoginInfo = nullptr;
                }

#endif
                UE_LOG_ONLINE_IDENTITY(Log, TEXT("[EOS] Connect login for user [%d]:[%s], using [%s] auth token"), LocalUserNum, *UserData->GetAccountIdString(), *PlatformTokenType);
                CALL_COUNTER(TEXT("EOS_Connect_Login"));
                EOS_Connect_Login(EOSConnectHandle, &Options, new FConnectLoginCallbackClientData(this, UserData, Credentials.Type, Delegate), OnConnectLoginCompleteCallback);
}
// More code ....

```

---

<div class="post-metadata">

**Author:** ![v.falcon.fishlab](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@v.falcon.fishlab](https://forums.unrealengine.com/u/v.falcon.fishlab)\
**Post date:** [November 18, 2024, 1:07pm UTC](https://forums.unrealengine.com/t/eos-sdk-apple-error-when-setting-eos-connect-userlogininfo-apiversion-to-eos-connect-userlogininfo-api-latest/2124985/2 "2024-11-18T13:07:28Z")

</div>

After trying to find a solution for this for a while I figured out that the actual issue was on how our code was structured, `EOS_Connect_UserLoginInfo UserLoginInfo{};` was inside a scope making the variable lifetime be less than the `EOS_Connect_Login` call

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [December 18, 2024, 1:08pm UTC](https://forums.unrealengine.com/t/eos-sdk-apple-error-when-setting-eos-connect-userlogininfo-apiversion-to-eos-connect-userlogininfo-api-latest/2124985/3 "2024-12-18T13:08:05Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
