Welcome to the Canon Community Forums and thank you for your post!
So that the Community can help you better, we will need to know exactly which Canon camera you're using, and if you're seeing any error messages on the display of your camera when you use your EF-S 18-55mm lens.
Any other details you'd like to give will only help the Community better understand your issue!
If this is an urgent support need, please CLICK HERE to reach our friendly Technical Support Team by phone or email.
Thanks and have a great day!
If this issue persists only with the EF-S 18-55mm then we recommend cleaning the lens contacts with a soft microfiber cloth. If the troubles do persist past that then I would recommend setting up service on this lens through our web site.
This sounds like the lens is failing to focus.
When the camera is in it's normal "One Shot" auto-focus mode it also uses a feature called "Focus Priority". Focus priority means that when you press the shutter button to take a shot it will not take the shot until it can confirm that it was able to focus (using either the focus point you selected or using any focus point if you allow it to auto-select the focus point.)
There's also a feature called "Release priority" which is used when the camera is in "AI Servo" auto-focus mode. AI Servo is used when photographing moving subjects (or anytime the camera-to-subject distance keeps changing as you shoot -- such as sports or action photography.) In release priority the camera will take the shot immediately whenever you press the shutter button down completely -- and it will do this whether it's had a chance to focus or not (the photographer would half-press the shutter button as they track their subject and the camera will continue to re-focus as the subject moves. Then they press the button down completely when they want the camera to take the shot.)
If the lens is unable to focus for any reason (focus motor failure, communication failure, lens jammed, etc.) then the camera will not be able to confirm successful focus and will refuse to take the shot in "One Shot" mode.
This is almost always a problem with the lens.
On the side of the lens change the AF/MF switch to the "MF" (manual focus) position to disable auto-focus. In this mode the camera will take a shot -- but of course the camera will no longer attempt to focus. Manually rotate the focus ring and make sure the focus mechanism isn't jammed or sticking (make sure you can focus from minimum focus distance out to infinity by turning the focus ring completely from one end of travel to the other, and back... and do this a few times to make sure you don't feel it getting stiff, sticking, hear strange noises, etc.)
It can be a poor connection from body to lens, but this is unusual and the fact that the camera works fine with your other lens indicates the pins on the camera body are likely fine. Check the gold contacts on lens to see if they appear dirty. The contacts are coating with gold and gold generally does not corrode nor tarnish. I should warn you this is just gold plating and it's very thin. Gold is soft and since the plating is thin, do not use anything abbrassive to clean the contacts (even a pencil eraser is too abbrassive.) Use nothing other than a soft cloth (you can moisten the cloth but wring all the water out of it so it's just damp -- not dripping wet.)
Put the lens back on the camera and switch the AF/MF switch back to the AF position. Test the lens by attempting to get it to focus and shoot.
If it fails, there's likely an internal problem with the lens. The lens is serviceable, but since service is essentially the cost of manual labor to evaluate, dissassemble, replace/repair parts, re-assemble, and test... the number of hours multiplied by the hourly rate can be costly ESPECIALLY in comparison with the cost of a replacement lens. It's worthwhile repair high-end lenses, but repair costs could exceed the value of an entry-level "kit" lens.
Canon has replaced the EF-S 18-55mm f/3.5-5.6 IS with the new EF-S 18-55mm f/3.5-5.6 IS STM lens. The new lens is faster and significantly quieter than the old lens and also improved a bit on the optical design.
Thank you Tim for your reply. I did clean the gold contacts, did not work. I then tried the lens in MF. It did take a picture, but only when it lens was not focused in closer on the object. If I manually focused in on an object, the object would not have a clear focus. So from what you have said I guess it would be best and more affordable just to buy the newer lens. Thank you.