A new quinoline based sensor was developed and applied for the selective detection of Cd2+ both in vitro and in vivo.