If it works fine when plugged in to an outlet but turns off when it isn't i would guess it's your battery that needs changing.my iPhone 4S keeps turning itself off. I am on a trip and will not be home for a week.
any ideas on cause or something I could try to fix it?
arrowsulu- you are right on. It was turning itself off before I left on a 5 day trip. I thought it needed a battery before I left so I had a new one put in by a recent hire at my local repair. It turned off immediately every time I tried while out of town so when I returned I took it back to the repair shop where I got the new battery. This time the regular staff checked it out and discovered that the screws were not sufficiently tightened and that the plate was continually shorting out. He tightened it and voila` - works great now! Thanks for nailing the cause and resolving this issue!Did you drop it before you started having problems? There are screws that hold a little piece of metal over where the battery clips to the mb. But if seen instances where a drop can dislodge it just enough to short out. You can buy or make a screwdriver to take the back cover screws out and investigate it yourself. (Only recommended if you know what your doing). Or you can take it to an apple store or a repair store and see what they can do. Good luck!