How to bind nsstring url

How can I concatenate an NSString URL? For instance:

 http://isomewebsite.com/username=[someuservariable]&password=[somevariable] 
+6
source share
3 answers

Try using the code below.

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

Here's a blog tutorial to help you learn more about Handling URL Authentication Requests When Accessing Password-Protected Servers

+7
source

You can use the stringWithFormat method for NSString:

 NSString *url = [NSString stringWithFormat:@"somewebsite.com/username=%@&password=%@", someuservariable, some variable]; 
+1
source

Try this great post - URL encoding NSString on iOS

0
source

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


All Articles