开发者

pass user credentials to server from iphone application

开发者 https://www.devze.com 2023-02-22 09:30 出处:网络
Greetings, I am making an iphone application to pass information between the application and the server database.

Greetings,

I am making an iphone application to pass information between the application and the server database. i have made an connection with the server database

NSURLRequest *reqURL = [NSURLRequest requestURL: [NSURL URLWithString:@"address"]];
NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:reqURL delegate:self];

Now i require to pass on the database name and the username and password to the da开发者_运维百科tabase. How can these credentials be passed on.


Well the easiest way would be to simply append the username and password to the url:

NSString *surl = [NSString stringWithFormat:@"https://my.server.net?username=%@&password=%@",username,password];
NSURLRequest *reqURL = [NSURLRequest requestURL: [NSURL URLWithString:surl]];
NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:reqURL delegate:self];
0

精彩评论

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