There are numerous reports of the camera in iOS 4 failing to open. I've seen it quite a bit on my iPhone 4, but it comes and goes. While some folks are swapping out hardware, I'm not so sure this is a hardware issue. I still advise you to call Apple or visit a Genius Bar, but this appears to be a memory issue more than anything. I'm hoping iOS 4.1 will fix the problem.
What happens is that you go to use the camera on your phone, and the shutter won't open. You may see this in the Camera app, or in other apps like Facebook or Ya Gotta See This! which use the iPhone's camera. In other apps it may simply be that you can't click the button to take a pic, or the image of what you'd see never appears. Either way, something is gumming up the works. Here are a few possible fixes:
1. If you're multitasking and you have a bunch of apps that use a lot of memory (games, usually) open when you double-click the home button, you may want to force some of those to close. Just hold down an icon for a couple of seconds as those you were going to move icons around, and you'll see a red circle with a white minus sign. Tap as many apps as you can live without for the moment, close out the shelf, and go back to the camera. If memory has cleared up, you may get a picture.
2. One way to clear the memory is to reboot the iPhone. Just hold down the power button until the red slider appears to power down the device. Turn it back on and see if you can take a picture.
More on the next page.
[Hat tip to Brandon Martinez]
3. The simplest thing to do is just relaunch the application itself. I found that 90% of the time this cleared things up. Almost as if iOS couldn't make enough memory available the first time, but on second run it unjammed whatever blockage it had before.
4. Try reinstalling the app. This won't work on Apple's own Camera app, unfortunately. But it's a cure-all fix that I'm not totally convinced does anything special. But it won't hurt you to try.
5. If none of those other fixes worked, you may want to try the old standby "wipe and restore" your iPhone. I tried to avoid this, because I hate having to re-enter data on my iPhone and losing all my game data. Unfortunately my trip to the Genius Bar hosed my iPhone so it was no longer associated with my iTunes, so I wound up having to spend 3 hours re-arranging icons anyway. Your mileage may vary, but Apple winds up telling a lot of people to nuke their iOS device as a troubleshooting method. The idea is it'll take any software glitches out of the equation and fast-track you to a hardware fix. Personally I think it's a chore, but their reasoning is what it is.