Note that there are some explanatory texts on larger screens.

plurals
  1. POSpaces in a NSURL with variables doesn't load
    primarykey
    data
    text
    <p>Hello everyone I have an objective-c dilema :P I am quite new to objective-c, and I have tried searching for an answer, but to no avail.</p> <p>So, here is my situation. I will put the code here now, or else it won't make as much sense. I am putting down what I need, this code does not work right now, and I will get to why later</p> <pre><code> NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; [formatter setDateFormat:@"MMMM"]; NSString *monthString = [formatter stringFromDate:date]; NSLog(@"MONTH STRING %@", monthString); NSString *baseURLStr = @"http://www.mysite.ca/example"; NSURL *url = [NSURL URLWithString:[baseURLStr stringByAppendingFormat:@"announcements%20%@%20%d%20carson.ashx", monthString]]; [webView loadRequest:[NSURLRequest requestWithURL:url]]; [NSCalendar release]; </code></pre> <p>So, this is where the problem lies... Encoded (HTML): stringByAppendingFormat:@"announcements%@%20%d%20example.ashx", monthString, day]];</p> <p>Decoded it looks like this</p> <p>stringByAppendingFormat:@"announcements %@ %d example.ashx"]];</p> <p>That should be easier to understand.. When I run with the %20's, it says "The requested document was not found" When I run with spaces (" ") it is just white, and nothing loads.</p> <p>I know the URL is correct, and if I take the variables out, it is the exact same problem, but when I move the %20's back to the baseURLStr, it works and loads just fine, so it is something to do with the HTML Codes and the "stringbyAppendingFormat" string.</p> <p>Any help is appreciated!</p> <p>Thanks for your time</p> <p>-Kyle</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload