Warning C4996 when passed to 4.24 from 4.23

Hello
I started receiving warning message when I build project:

\Battleships\BaseBattleship.cpp(351): warning C4996: ‘AActor::GetComponentsByClass’: Use one of the GetComponents implementations as appropriate Please update your code to the new API before upgrading to the next release, otherwise your project will no longer compile.

2> C:\Program Files\Epic Games\UE_4.24\Engine\Source\Runtime\Engine\Classes\GameFramework/Actor.h(2881): note: see declaration of ‘AActor::GetComponentsByClass’

And in line 351 I have:

for (auto ActorComponent : GetComponentsByClass(UOffensiveAttachmentComponent::StaticClass()))

inside of function: TArray ABaseBattleship::GetOffensiveModulesAttachmentComponents() const { TArray<UOffensiveAttachmentComponent*> ComponentsArray; for (auto ActorComponent : GetComponentsByClass(UOffensiveAttachmentComponent::StaticClass())) { if (auto OffensiveSceneComponent = Cast<UOffensiveAttachmentComponent>(ActorComponent)) { ComponentsArray.Add(OffensiveSceneComponent); } } return ComponentsArray; }

I found similar case: https://forums.unrealengine.com/development-discussion/c-gameplay-programming/1699015-4-24-c-transition-guide
But it dont clear for me what to do.
Help me please(

Hi. I have this warning in engine version 4.25.1. I think we need to use one of the GetComponents function overrides:

TArray<UActorComponent*> Components;
		Actor->GetComponents(UEmployeeComponentBase::StaticClass(), Components);
		for (auto comp : Components)
		{
			UEmployeeComponentBase* eComp = Cast<UEmployeeComponentBase>(comp);
			if (eComp != nullptr)
			{....}
		}