After checking for lens seating, which creates a problem more with sling straps due to hanging by one's side, the next check point when it happens is to turn off the camera and back one. If there is a software execution problem(probably not a code problem or else we would all have it), rebooting clears many problems whether a complex camera or your cell phone or microwave oven.
The advice to clean contacts with abrasive pencil eraser is very poor. Scratching the gold alloy plated contacts will guarantee future contact problems with increased pitting and higher resistance, intermittent contacts. If contacts are intermittent, it is because either mechanical misalignment(not making contact) or the insulating effects of oxidation. Oxidation is not dirt so does not respond to solvents and only works with abrasives by grinding down the very thin plating. Oxidation can be more common with lenses that do not get changed often or sitting in the bag without a cover. The normal action of mounting and unmounting a lens should keep the oxidation layer thickness lower than that which would prevent electrons from migrating across the thin oxide layer that coats the external surfaces of almost all metals. When the oxide of the metal used in the gold alloy gets thick enough, 6-10 molecules thick electrons have a harder time making the jump, and much thicker and the oxide becomes a very effective insulator. How to de-oxidize the contacts? Use a deoxidizing chemical that has a higher attraction to the surface oxygen than the base metal does. A common de-oxidizer is Caig Laboratories D-5 DeOxit. A tiny amount will remove the oxide without harming the metal at all. A bit on a Q-Tip will be enough to keep oxide from forming for 6-12 months. Any electronics supply house will have it. Do not let a salesman talk you into "contact cleaner" which is a strong solvent and increases oxidation. All the mentions on the forum about using 3rd party grips or batteries voiding the Nikon warranty are wrong and plain silly but using an eraser on gold contacts really should void the warranty because it is clear abuse. If the tech looks at the contacts with a loop, he will clearly see the signs of abuse and has every right to deny coverage. Stan St Petersburg Russia