I have the following code and I cannot work out from the IOS developer documentation how to add some selection criteria (for the PHP) to the url
My php works when I add /?category=sports but how to I get this added to my kGETUrl string
NSURL *url = [NSURL URLWithString:kGETUrl];
NSData *data = [NSData dataWithContentsOfURL:url];
use stringWithFormat
to add parameters.
NSString *urlString = [NSString stringWithFormat:@"%@/?category=sports", kGETUrl];
NSURL *url = [NSURL URLWithString:urlString];
NSData *data = [NSData dataWithContentsOfURL:url];
if you want to get sports part from a variable;
NSString *urlString = [NSString stringWithFormat:@"%@/?category=%@", kGETUrl, categorySelected];
NSURL *url = [NSURL URLWithString:urlString];
NSData *data = [NSData dataWithContentsOfURL:url];