If there is dirt on the contacts of the body or the lens, the camera body may not recognize the lens due to attachment failure. Wipe dirt from the contacts using a cotton swab or a dry soft cloth (cleaning cloth, etc.), then attach the lens to the camera body.