Hello, I’ve tested my project using the NULL subsystem and all works well. I’m attempting to give OnlineSubsystemIOS a shot. My app is set up on the developer portal correctly and all of my provisions/apple-specific settings are correct. I receive a warning when packaging my project and I can’t seem to get a successful find sessions callback no matter what I try. Anyone have any clue how to solve this? Doesn’t seem to be much out there about UnrealEngine + IOS Multiplayer:
Packaging error: PackagingResults: Warning: OSS: TryLoadSubsystemAndSetDefault: LoadSubsystemModule([IOS]) failed
UProject: {
“Name”: “OnlineSubsystemIOS”,
“Enabled”: true,
“SupportedTargetPlatforms”: [
“IOS”
]
}
Engine.ini: {
“Name”: “OnlineSubsystemIOS”,
“Enabled”: true,
“SupportedTargetPlatforms”: [
“IOS”
]
}
Here is a snippet of the code (called via blueprints): void ARaceGameMode::CreateGameSession()
{
//GetOnlineSubsystem();
if (!OnlineSessionInterface.IsValid())
{
UE_LOG(LogTemp, Error, TEXT(“OnlineSessionInterface is not valid.”));
return;
}
auto ExistingSession = OnlineSessionInterface->GetNamedSession(NAME_GameSession);
if (ExistingSession != nullptr)
{
UE_LOG(LogTemp, Warning, TEXT("A session already exists, attempting to destroy it."));
OnlineSessionInterface->DestroySession(NAME_GameSession);
}
OnlineSessionInterface->AddOnCreateSessionCompleteDelegate_Handle(CreateSessionCompleteDelegate);
TSharedPtr<FOnlineSessionSettings> SessionSettings = MakeShareable(new FOnlineSessionSettings());
SessionSettings->bIsLANMatch = true;
SessionSettings->NumPublicConnections = 4;
SessionSettings->bAllowJoinInProgress = true;
SessionSettings->bAllowJoinViaPresence = true;
SessionSettings->bShouldAdvertise = true;
SessionSettings->bUsesPresence = true;
SessionSettings->bUseLobbiesIfAvailable = true;
SessionSettings->Set(FName("MatchType"), FString("FreeForAll"), EOnlineDataAdvertisementType::ViaOnlineServiceAndPing);
UE_LOG(LogTemp, Log, TEXT("Creating session with settings: LAN Match: %s, Public Connections: %d, Uses Presence: %s"),
SessionSettings->bIsLANMatch ? TEXT(“Yes”) : TEXT(“No”),
SessionSettings->NumPublicConnections,
SessionSettings->bUsesPresence ? TEXT(“Yes”) : TEXT(“No”));
const ULocalPlayer* LocalPlayer = GetWorld()->GetFirstLocalPlayerFromController();
if (!LocalPlayer || !LocalPlayer->GetPreferredUniqueNetId().IsValid())
{
UE_LOG(LogTemp, Error, TEXT("LocalPlayer is null or has an invalid NetID."));
return;
}
OnlineSessionInterface->CreateSession(*LocalPlayer->GetPreferredUniqueNetId(), NAME_GameSession, *SessionSettings);
}
void ARaceGameMode::JoinGameSession()
{
GetOnlineSubsystem();
UE_LOG(LogTemp, Log, TEXT(“Attempting to join a game session.”));
if (!OnlineSessionInterface.IsValid())
{
UE_LOG(LogTemp, Error, TEXT("OnlineSessionInterface is not valid."));
return;
}
// Add the find sessions complete delegate
OnlineSessionInterface->AddOnFindSessionsCompleteDelegate_Handle(FindSessionsCompleteDelegate);
// Create the session search object
SessionSearch = MakeShareable(new FOnlineSessionSearch());
SessionSearch->MaxSearchResults = 1000;
SessionSearch->bIsLanQuery = true;
SessionSearch->QuerySettings.Set(SEARCH_PRESENCE, true, EOnlineComparisonOp::Equals);
// Get the local player
const ULocalPlayer* LocalPlayer = GetWorld()->GetFirstLocalPlayerFromController();
// Start the session search
OnlineSessionInterface->FindSessions(*LocalPlayer->GetPreferredUniqueNetId(), SessionSearch.ToSharedRef());
}
Here is a piece of my OnFindSessions callback: void ARaceGameMode::OnFindSessionsComplete(bool bWasSuccessful)
{
if (!OnlineSessionInterface.IsValid())
{
UE_LOG(LogTemp, Error, TEXT(“OnlineSessionInterface is not valid in OnFindSessionsComlete!”));
return;
}
if (!bWasSuccessful)
{
UE_LOG(LogTemp, Error, TEXT("FindSessions was not successful."));
return;
}
if (!SessionSearch.IsValid())
{
UE_LOG(LogTemp, Error, TEXT("SessionSearch is not valid."));
return;
}
if (SessionSearch->SearchResults.Num() == 0)
{
UE_LOG(LogTemp, Warning, TEXT("No sessions found."));
return;
}
bWasSuccessful never returns true so I can’t call join session or anything. I’ve tried this from blueprints as well using the default nodes and get a similar issue (but can’t step through an Xcode debugger to really see what’s going on). I’m thinking it has to due with that packaging error, my IOS plugin is installed and I’ve tried regenerating project files multiple times - any info is appreciated!