The obstruction cochain is zero iff a map has an extension. On page 142 of this book, we define

Definition. Fix $n\geq 1$. A connected space $X$ is said to be $n$-simple if $\pi_1(X)$ is Abelian and acts on the homotopy groups $\pi_q(X)$ for $q\leq n$.


Definition. Let $(X,A)$ be a relative CW complex with relative skeleta $X^n$ and let $Y$ be an $n$-simple space. Given a continuous map $f:X^n\rightarrow Y$, we define the obstruction cocycle $c_f\in C^{n+1}(X,A;\pi_n(Y))$ to be $c_f(j)=[f\circ j]$ for an attaching map $j:S^n\rightarrow X^n$ of each $(n+1)$-cell of $(X,A)$.

Here we use the notation:

For a relative CW complex $(X,A)$, let $C_n(X, A)$ denote the free group generated by the set of all attaching maps of relative $n$-cells of $(X,A)$. Then the cellular chain complex $C_*(X,A)$ gives the cellular cochain with coefficients in an Abelian group $\pi$ as $C^*(X,A;\pi)=Hom(C_*(X,A),\pi)$. Moreover, we may then define the cellular cohomology groups to be $H^*(X,A;\pi)=H^*(C^*(X,A;\pi))$.

My question. I try to prove the statement:

Theorem. The restriction of $f$ to $X^{n-1}$ extends to a map $X^{n+1}\rightarrow Y$ if and only if $[c_f]=0$ in $H^{n+1}(X,A;\pi_n(Y))$.

In this proof on page 142, it says that it is clear that $f$ extends to $X^{n+1}$ if and only if $c_f=0$. But I cannot think so. In addition, I cannot find where he applies the hypothesis concerning $Y$.
Moreover, in the last theorem on page 142, I have a similar question as this.
Could you give me advice? Thanks in advance.
 A: For the very first part, assume for simplicity that $X^{n+1}=X^{n} \cup e^{n+1}$, and that $A=\emptyset$. To handle the case where there are more cells, you can argue by formally extending linearly in $C_{n+1}(X)$ which is freely generated by the (n+1) cells in $X$. For the case where $A \neq \emptyset$ you make everything relative.
Let $\varphi:S^{n} \to X^{n}$ be the attaching map for $e^{n+1}$. Then $f$ induces a homomorphism $C_{n+1} \to \pi_n(Y)$ by sending $e^{n+1}$ to $f \circ \varphi$.(**) The result is that this term is zero if and only if $f \circ \varphi$ is nullhomotopic. Then you conclude by noting that a map $S^n \to Y$ is nullhomotopic if and only if it has an extension to a disk, i.e: the cell $e^{n+1}$.
(**) The hypothesis involving $Y$ is used to ensure that the action of $\pi_1$ is trivial on all homotopy groups. This is used to force the relation that $[S^n,Y]=[S^n,Y]_*=\pi_n(Y)$.Without this, there is an ambiguity about basepoints. Basically for this to be a homomorphism actually landing in $\pi_n(Y)$ we need to choose a path from $f(x_0)$ to $y_0$ etc. but all of this is unambiguous when $Y$ is simple.
You may circumvent this issue by using local coefficients, i.e: passing to the universal cover of $Y$ and using the fact that $\pi_n(Y)=\pi_n(\tilde{Y})$, but now instead this is a $\mathbb Z[\pi_1(X)]$-module via $f$.
