An isomorphism of based homotopy maps $[X,S^1]$ to homomorphisms of their fundamental group. This is the last question on a topology 1 exercise sheet, so hints aswell as solutions are highly appreciated!
We are given a based connected CW-complex $(X,x)$, and the map $$W:[X,S^1]_*\rightarrow Hom(\pi_1(X),\mathbb{Z}),$$
that is given by taking fundamental groups: $W([f]) = ([w]\mapsto[f\circ w])$.
Now this map is well-defined by functoriality and also it is a group homomorphism. What I want to show is that this is an isomorphism, but I'm stuck everytime I want to show surjectivity or injectiviy by hand. Extending maps from generators doesn't seem to cut it, and I'm running out of ideas. I was given a tip on the sheet: "Reduce to the case where X has only one 0-cell".
I found a related theorem in Hatcher (4.57 according to this question here). However, we have only defined homology groups and have only proven basic theorems about them, so I doubt this is the way to go (this is only week 6 of a topology 1 course).
Any help is appreciated, thanks!
 A: Here is a sketch of how to show surjectivity (be warned that the details may be fairly nontrivial to fill in if you are not used to this sort of argument).  We start by assuming, as your hint suggests, that $X$ has a single $0$-cell (to reduce to this case, try taking a quotient by an appropriate contractible subcomplex).  Now, given a homomorphism $\varphi:\pi_1(X)\to\mathbb{Z}$, we want to construct a map $f:X\to S^1$ inducing it.  We will construct $f$ cell-by-cell, starting with sending the unique $0$-cell to the basepoint.  Each $1$-cell is a loop in $X$, and so $\varphi$ tells us what $f$ needs to do on it up to homotopy.
Having defined $f$ on the $1$-cells, we now extend to the 2-cells.  To extend $f$ over a $2$-cell, we need to pick a nullhomotopy of the composition of $f$ with the attaching map of the $2$-cell.  This is always possible because the attaching map is homotopic to some composition of the loops around the $1$-cells of $X$, and that composition is trivial in $\pi_1(X)$.  Since $f$ maps the $1$-cells according to $\varphi$ which is a homomorphism on $\pi_1(X)$, $f$ therefore maps the attaching map to something nullhomotopic.
Now we need to extend $f$ over the $3$-cells, and $4$-cells, and so on.  To extend over an $n$-cell, for instance, we need to pick a nullhomotopy of its attaching map composed with $f$.  But every map $S^{n-1}\to S^1$ is nullhomotopic if $n>2$, so this is always possible.
So, that's a sketch of surjectivity.  Injectivity is similar, except that we are extending homotopies instead of maps: given $f,g:X\to S^1$ which induce the same map on $\pi_1$, we build a homotopy between $f$ and $g$ cell-by-cell on $X$.
