This happened to be me the other day and I was stressing for ages. Ended up being the lens was not seated properly on the camera. Somehow it had twisted very slightly and so the contacts weren't lined up. I was absolutely bladdered at the time ha ha so I'd probably pressed the lens release button for some stupid reason.
Take ur lens off, make sure all the contacts are there and look ok, and put it back on.