SSL connections from within iPhone applications
As of Charles v3.9.3 there is an item in the Help menu, "Install Charles CA SSL Certificate in iOS Simulators", which will automatically install Charles's SSL CA certificate in your iOS Simulators.
Alternatively, you can change your code so that NSURLConnection accepts any SSL certificate. Please see the question and answer on Stack Overflow: http://stackoverflow.com/questions/933331/how-to-use-nsurlconnection-to-connect-with-ssl-for-an-untrusted-cert
If you're only browsing a single website in Safari you can just accept the certificate in Safari and that will work for that site. If the SSL site is only being used to load resources such as images, then you'll need to visit it directly and accept the certificate before it will work.
iOS 4 and later
On the device, set your HTTP proxy to use Charles, and then browse to http://www.charlesproxy.com/getssl to install the certificate.
Note that some apps implement SSL certificate pinning which means they specifically validate the root certificate. Because the app is itself verifying the root certificate it will not accept Charles's certificate and will fail the connection. If you have successfully installed the Charles root SSL certificate and can browse SSL websites using SSL Proxying in Safari, but an app fails, then SSL Pinning is probably the issue.