I've worked around this by simply building my URL string completely by hand, but I'd like to learn...

iPhone OS 3.0.

At +initialize time, my class sets up a static NSURL object:

sBaseURL = [[NSURL alloc] initWithScheme: @"http"
                                host: @"www.example.com:8080"
                                path: @"/"];

NSURL treats an empty or nil path as illegal.

Later, I build up a path:

NSMutableString * path = [NSMutableString stringWithString: @"calendar/ join?"]; [path appendFormat: @"start_date=%@", [sDirserverParamFormat stringFromDate: start]]; [path appendFormat: @"&end_date=%@", [sDirserverParamFormat stringFromDate: finish]];

(sDirserverParamFormat is an NSDateFormatter static.)

And then I construct the URL I want to load from:

NSURL * queryURL = [NSURL URLWithString: path relativeToURL: sBaseURL];

However, the resulting URL chokes my server (Rails 2.x, if it matters). The URL string generated by this method is like

http://www.example.com:8080//calendar/join?start_date=20090601&end_date=20090630

Note the doubled slash before "calendar." My server is perfectly happy if it's a single slash.

Is this a nonconformity in my server, or should I be able to use relative paths in NSURL to generate paths without double slashes? If the latter, how do I do that?

I've Googled "NSURL double slash," and found an "openradar" bug that's similar. If nobody has guidance on this, I'll file a real radar.

        — F

_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to