I just finished implementing my first iPhone application , everything went well, now I need to supply a sort of security to my application and I don't know what is the best way to do that ?
Currently it works like this : the user enters his user name and password , the server verifies that this is the correct information , when I made another request to the server it asks for a user name and password so it returns to the method named didReceiveAuthenticationChallenge. I provide the user name and password again , the server verifies that, and sends the request again.
My questions are : Is this a correct behavior? is there any kind of session for iphone? And how can I use cookies to save user name and password ?
Also I stored newCredential = [NSURLCredential credentialWithUser:username password:password persistence:NSURLCredentialPersistenceForSession];
But it not stored for session. Is there problem in my code on the iPhone or the PHP script that we are calling?