Hatcher's Algebraic Topology Corollary 4.19 states :
An $n$-connected CW model for $(X,A)$ is unique up to homotopy equivalence $\text{rel} ~A$. In particular, CW approximations to spaces are unique up to homotopy equivalence.
I understood the first statement, but I can't see how the second statement follows. A CW approximation to a space is by definition a weak homotopy equivalence $f:Z \to X$ where $Z$ is a CW complex. ($X$ is not necessarily path-connected)
On the other hand, an $n$-connected CW model for $(X,A)$ is by definition a CW pair $(Z,A)$ (thus, $A$ must be a CW complex, while $X$ need not) with a map $f:(Z,A)\to (X,A)$ such that $f|_A=1_A$, and $f_*:\pi_i(Z) \to \pi_i(X)$ is an isomorphism for $i>n$ and an injection for $i=n$ for all choices of basepoint. Also we cannot choose $A=\emptyset$, by definition (explained in p.354).
To show that CW approximations to spaces are unique up to homotopy equivalence, first let $X$ be an arbitrary space, and let $f:Z \to X, g:Z' \to X$ be two CW approximations. I think should use the uniqueness statement of CW models, then I have to take a subspace $A$ of $X$, which is a CW complex, but I have no idea with this. How do I have to proceed?
You're right that the case of CW approximations does not follow in any obvious way. Hatcher seems to have gotten himself in a little trouble through his insistence on avoiding empty sets, which is entirely unnecessary and seems to only be done for convenience of talking about homotopy groups with basepoints in a few arguments. But you don't need a basepoint to talk about $\pi_0$ ($\pi_0(X)$ can be defined as just the set of path-components of $X$, and $\pi_0(X,A)$ being trivial means that $A$ intersects every path-component of $X$). With this in mind, there is nothing wrong with allowing $A=\emptyset$ or $n=-1$ in the definition of an $n$-connected CW model, and all the proofs easily extend to include these cases. A $(-1)$-connected CW model for $(X,\emptyset)$ is then the same thing as a CW approximation for $X$.
Alternatively, the uniqueness of CW approximations instead follows from Proposition 4.22 by essentially the same argument as the proof of Corollary 4.19 using Proposition 4.18. If $f:Z\to X$ and $g:Z'\to X$ are two CW approximations, then by Proposition 4.22 $g$ induces a bijection $[Z,Z']\to [Z,X]$, and taking the preimage of $[f]$ under this bijection gives a map $h:Z\to Z'$ such that $gh\simeq f$. Similarly there is a map $h':Z'\to Z$ such that $fh'\simeq g$. You can then conclude that $h'h\simeq 1_{Z}$ since $fh'h\simeq gh\simeq f=f1_{Z}$ and composition with $f$ is an injection $[Z,Z]\to [Z,X]$, and similarly $hh'\simeq 1_{Z'}$.