开发者

How do you manage Register and Login users in iOS application?

I would like to allow users register and login so they can access more functionality from the App. There is a Server the app connects to for retrieve data, and register users would be able to write data to it also.

How do开发者_StackOverflow you manage registration and login in iOS?

1.- Is it easier to let the app do all the job in the server, checking and writing to a database of users?

2.- Is it better to write a php script to do the registering and login and then let the iPhone app send the info to the script in a post?

Sorry for the vague question but I am a bit lost in this area. I have read many posts, but have not clear understanding.


It definitely is much better to write a PHP Script which the iPhone App can interface to with a simple API and sending the details as parameters in a POST request or PUT request (REST style API) rather than interfacing with the Server directly. In the PHP Script, you would do validation and the methods to enter the data into the Database.

You would have an API coded in PHP (doesn't need to be complicated) where you can pass in data through some sort of parameters. In your iPhone App, you would then create a native register form using UITextFields and the like and then once the User hits the register button, it will execute a POST request to send the data to the server and will get back a response which you can see if the data the User entered is valid. You can also do validation on the iPhone form before sending off (ensuring fields aren't blank, confirm to some format) etc.

Also, similar to register, for Login you could simply query a separate script to check if the credentials are valid which then could return a success or some sort of authentication token to use with future requests in your parameters.

Always assume that the data sent could potentially be malicious, this is why you need to do validation within your PHP script to protect yourself securely

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜