Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

chhoda

macrumors 6502
Original poster
Oct 25, 2008
285
1
Hi All,

I am getting a strange error.

NSString *filePath = [[NSBundle mainBundle] pathForResource:mad:"direction" ofType:mad:"html"];

// NSString *params = [NSString stringWithFormat:mad:"?dirstr=%@", @"from: 500 Memorial Drive, Cambridge, MA to: 4 Yawkey Way, Boston, MA 02215 (Fenway Park)"/*directioncommand*/];
// filePath = [filePath stringByAppendingString:params];

NSString *fileURLString = [[NSURL fileURLWithPath:filePath] absoluteString];
NSString *params = [NSString stringWithFormat:mad:"?dirstr=%@", @"from: 500 Memorial Drive, Cambridge, MA to: 4 Yawkey Way, Boston, MA 02215 (Fenway Park)"/*directioncommand*/];
fileURLString = [fileURLString stringByAppendingString:params];
NSURL *fileURL = [NSURL URLWithString:fileURLString];


I am trying to for an url and append parameter to it. unfortunately I am getting url as nil. Is there any way i can see the error ? If i copy paste the string from nslog to the browser it works fine.

thanks and regards
ch
 

dejo

Moderator emeritus
Sep 2, 2004
15,982
452
The Centennial State
I would guess it's because the parameter part of your URL contains spaces (i.e. "from: 500 Memorial Drive..."), which isn't allowed. Try calling stringByAddingPercentEscapesUsingEncoding: on it first.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.