Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to concatenate an nsstring url

How can I concatenate an NSString URL? For example:

http://isomewebsite.com/username=[someuservariable]&password=[somevariable]
like image 783
Bilal Avatar asked Apr 21 '11 07:04

Bilal


2 Answers

Try with below code.

NSString* myURLString = [NSString stringWithFormat:@"somewebsite.com/username=%@&password=%@", myUserName,myPassword];
NSURL *url = [NSURL URLWithString:myURLString];

Here is the blog tutorial will help you know more about Handling url authentication challenges accessing password protected servers

like image 165
Jhaliya - Praveen Sharma Avatar answered Nov 02 '22 01:11

Jhaliya - Praveen Sharma


You can use the method stringWithFormat of NSString:

NSString *url = [NSString stringWithFormat:@"somewebsite.com/username=%@&password=%@", someuservariable, some variable];
like image 34
Matteo Alessani Avatar answered Nov 02 '22 00:11

Matteo Alessani