Infinitely many solutions for a nonlinear Schrödinger equation with general nonlinearity