0
+ 문자가있는 전화 번호를 포함하여 세부 정보를 서버에 요청하여 문제가 발생했습니다. 서버 쪽 끝에 + 문자가 표시되지 않습니다. 웹 서버에 URL 요청을 보내는 동안 + 문자를 처리하는 방법
curl = [curl stringByAppendingString:@"name="];
curl = [curl stringByAppendingString:profileObj.name];
curl = [curl stringByAppendingString:@"&email="];
curl = [curl stringByAppendingString:profileObj.email];
curl = [curl stringByAppendingString:@"&password="];
curl = [curl stringByAppendingString:profileObj.password];
curl = [curl stringByAppendingString:@"&phoneno="];
curl = [curl stringByAppendingString:profileObj.phoneno]; // here my data is +919999999999
curl = [curl stringByAppendingString:@"&address="];
curl = [curl stringByAppendingString:profileObj.address];
curl = [curl stringByReplacingOccurrencesOfString:@"\n" withString:@""];
NSString *escapedUrlString = [curl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL *finalURL = [NSURL URLWithString:escapedUrlString];
[self updateStatus];
if (internetConnectionStatus == NotReachable)
{
UIAlertView *reachbleAlert = [[UIAlertView alloc] initWithTitle:@"Network Error"
message:@"No Network Available. \n This Application requires network connectivity. "
delegate:self
cancelButtonTitle:@"Ok"
otherButtonTitles: nil];
[reachbleAlert show];
[reachbleAlert release];
return;
}
else
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:finalURL
cachePolicy:NSURLRequestReloadIgnoringCacheData
timeoutInterval:10];
[theRequest setHTTPMethod:@"POST"];
[[[NSURLConnection alloc] initWithRequest:theRequest delegate:self] autorelease];
[pool release];
}
나는 선 아래 사용 :
NSString *escapedUrlString = [curl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
서버에 요청하기 전에. 그래서 제발 + 문자를 처리하는 솔루션을 도와주세요.