开发者

pass user credentials to server from iphone application

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜