I am trying to convert a string into url but not getting success. any better way to do, or improve the below code. thanks
NSString *strURL = @"http://domain.com/This Is My, Code for This. app";
NSString *escapedUrlString = [strURL stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSLog(escapedUrlString);
It is showing this log
http://domain.com/This2s2y,芙ode
0.000000or2his.20×1.55e800047f4p-1029pp
Here is my actual code sending and save data to mysql
NSString *data = @"This Is My, Code for This. app";
NSString *strURL = [NSString stringWithFormat:@"http://domain.com/connection.php?data=%@", data];
NSData *dataURL = [NSData dataWithContentsOfURL:[NSURL URLWithString:strURL]];
NSString *strResult = [[NSString alloc] initWithData:dataURL encoding:NSUTF8StringEncoding];
NSURL *urll = [NSURL URLWithString:strResult];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:urll];
[request setHTTPMethod:@"GET"];
NSURLResponse *response;
NSError *err;
NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&err];
NSLog(@"responseData: %@", responseData);
No success with this, but when I use
data = @"ThisIsMyCode";
Then everything works fine…
Help
This works fine, this is the log: