$\mathbf {The \ Problem \ is}:$ Let $X$ is a locally compact, separable metric space and $A\subset X$ be closed. Assume all the cohomology groups here are Čech cohomology. Let $G$ be an abelian group and $n\in \mathbb{N}.$ If the homomorphism $j^n_{X,A} : H^n(X;G)\to H^n(A;G)$ is a surjection, then show that every continuous map $f : A\to K(G,n)$ can be extended to a continuous map from $X\to K(G,n)$ where $K(G,n)$ is the Eilenberg-McLane space of type $(G,n).$
$\mathbf {My \ approach}:$ By the Brown Representation theorem , as $H^n$ is a half-exact functor, so the group of all homotopy classes of maps from $C$ to $K(G,n)$ i.e. $[C,K(G,n)]$ is isomorphic to $H^n(C;G)$ where $C$ is a countable $CW$-complex . But can we apply Brown Representation theorem for any locally compact, separable metric space ? If yes, then any map $f : A\to K(G,n)$ is homotopic to a map $g\mid_{A}$ where $g$ is a map from $X$ to $K(G,n)$ but how can we show the equality of $f$ with some $\tilde{g}\mid_{A}$ where $\tilde{g}\mid_{A} : X\to K(G,n) ?$ I think it's quite easy but I can't see it immediately. Thanks for any hints, references etc.
P.S. : Actually, the problem arose during proving that the cohomological dimension of a locally compact space separable metric space $X,$ $\operatorname{dim}_GX \leq n$ if and only if for any closed subset $A\subset X,$ any map from $A$ to $K(G,n)$ has a continuous extension from the whole space $X$ to $K(G,n).$ The long exact sequence for the pair $(X,A)$ for Čech cohomology gives the fact that the homomorphism $j^n_{X,A}$ is a surjection if and only if $\operatorname{dim}_GX \leq n$ but transferring the problem to the homotopy classs of maps to $K(G,n)$ initiated my doubts. In many books and articles, they have been assumed to be true without any proof and so I think it's not that difficult but I am unable to see anything immediately.