Logging In / Out of the iPhone App

I would like to learn how to control user login and logout into IPhone native applications. For example, every time my application starts, the user must log in. The information that the application executes and the list of users on the website running php + mysql. What is the β€œstandard” procedure for this? Is there a library to handle user login on a remote site?

What solutions did you use? biscuit? php sessions?

Any help or link to a useful website would be greatly appreciated.

+3
source share
1 answer

, , , - NSURLConnection, - :

-(void)connection:(NSURLConnection *)connection
didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge{

if ([challenge previousFailureCount] == 0) {
    NSURLCredential *newCredential;
    newCredential=[NSURLCredential credentialWithUser:[UserManager getUsername]
                                             password:[UserManager getPassword]
                                          persistence:NSURLCredentialPersistenceNone];
    [[challenge sender] useCredential:newCredential
           forAuthenticationChallenge:challenge];

} else {

    [[challenge sender] cancelAuthenticationChallenge:challenge];
    // inform the user that the user name and password
    // in the preferences are incorrect
}
}

[UserManager getUsername] [UserManager getPassword] - ,

+1

Source: https://habr.com/ru/post/1713544/