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];
精彩评论