我有一个给出路径的字符串,还有一个将参数附加到它的字符串。当我把它们放在一个字符串中并显示时,我得到了正确的格式。如果我尝试将整个字符串放在 NSURL 中,它会显示 NULL。获取它的格式是什么?
NSString *booking=urlForBooking.bookHall;
NSLog(@" book %@",booking); // this prints --- http://10.2.0.76:8080/ConferenceHall/BookingHallServlet
NSString *bookingString=[booking stringByAppendingString:[NSString stringWithFormat:@"? employeeId=%@&conferenceHallId=%@&bookingId=%d&purpouse=%@&fromDate=%@&toDate=%@&comments=%@&submit=1",empId,_hallId,_bookingId,_purpose,fromDateStr,toDateStr,_comments]];
NSLog(@"book str %@",bookingString); //this prints --- ?employeeId=3306&conferenceHallId=112&bookingId=0&purpouse=S&fromDate=25/Feb/2013 13:29&toDate=25/Feb/2013 15:29&comments=C&submit=1
NSURL *bookingURL=[NSURL URLWithString:bookingString];
NSLog(@"BOOK %@",bookingURL); //here I'm not getting the url(combined string), it gives null.