do you have to pay to publish the app or what???
Yes. You have to pay for the cryptographic keys to install apps on your device and sell them on the app store.
That's wrong.
That's wrong.
What's wrong with it?
You will need Provisioning profiles to register and install the app on your device to test the app and to submit the app to apple's app store. For this you need to pay to join the dev program.
I suspect you are talking about jailbraking the device. Personally I would never do that so I ruled it out.
Why would you never jailbreak? It's your device, why shouldn't you be able to install the programs you created on it?
I am using Xcode to make an iPhone app but I am not sure how the apple developer program works, do you have to pay to publish the app or what???