© 2017 American Physical Society. We generalize the diffusive model for spin injection and detection in nonlocal spin structures to account for spin precession under an applied magnetic field in an anisotropic medium, for which the spin lifetime is not unique and depends on the spin orientation. We demonstrate that the spin precession (Hanle) line shape is strongly dependent on the degree of anisotropy and on the orientation of the magnetic field. In particular, we show that the anisotropy of the spin lifetime can be extracted from the measured spin signal, after dephasing in an oblique magnetic field, by using an analytical formula with a single fitting parameter. Alternatively, after identifying the fingerprints associated with the anisotropy, we propose a simple scaling of the Hanle line shapes at specific magnetic field orientations that results in a universal curve only in the isotropic case. The deviation from the universal curve can be used as a complementary means of quantifying the anisotropy by direct comparison with the solution of our generalized model. Finally, we applied our model to graphene devices and find that the spin relaxation for graphene on silicon oxide is isotropic within our experimental resolution.