jxdwinter
jxdwinter

Reputation: 2369

NSURL URLWithString the url is always nil

My code is like this :

NSString *urlStr = [NSString stringWithFormat:@"https://xxx.xxx.xx.xx/Pages/Service/FMService.svc/FileAudit?user=%@&pass=%@&fileId=%d&isAudited=1&opinion=%@",appDelegate.user.userName,appDelegate.user.password,self.todo.fileId,self.opinion];
    NSLog(@"URL=%@",urlStr);        
    NSURL *url = [NSURL URLWithString:urlStr];

And the url = (NSURL *) 0*00000000@"< nil >"

how can I work it out? thank you in advance!

Upvotes: 0

Views: 2541

Answers (1)

StephenAshley.developer
StephenAshley.developer

Reputation: 1064

For debugging purposes, I would build up urlStr piece by piece instead of combining five NSStrings all at once. Put in an NSLog(@"%@", urlStr) statement after each addition to urlStr. This will reveal which piece of the puzzle is causing the problem.

Upvotes: 2

Related Questions