Just a few thoughts--of course no one has the solution to every problem like this!
Make every effort to let her know that you are both on the same team. It helps to keep in mind that four-year-olds are just beginning to have some control over their life. At this age, control is an amazing and exciting concept, and takes a lot of practice to learn how to use it.
Key point #1-don't give in just because you're tired
Key point #2-don't disagree for the sake of arguing...take time to make sure your child knows you will listen to her.
But it is a lot easier to talk about the concepts, than to actually know exactly what to do when your child goes bonkers because she can't have the candy or toy that she wants NOW.
Have you read any parenting books? If you can spend some time in a bookstore, or on Amazon.com...and browse through a few, maybe you can find one that fits your situation.