Re: NSBundle from an URL.
Re: NSBundle from an URL.
- Subject: Re: NSBundle from an URL.
- From: Ken Thomases <email@hidden>
- Date: Thu, 3 Sep 2009 17:41:49 -0500
On Sep 3, 2009, at 5:36 PM, Erik Ă–sterlund wrote:
I just wanted to check out NSBundle's + bundleFromURL. I looked in
the documentation and said nothing about only some protocols
working, so I thought I could load a bundle via HTTP which would be
awesome, but that seemed to fail. Is this a bug, or am I being stupid?
Here is my code:
#import <Cocoa/Cocoa.h>
int main(int argc, char *argv[])
{
NSAutoreleasePool* pool = [NSAutoreleasePool new];
[NSApplication sharedApplication];
NSURL* url = [NSURL URLWithString:@"http://localhost/TestServer2.bundle
"];
NSBundle* bundle = [NSBundle bundleWithURL:url];
NSString* nib = [bundle
objectForInfoDictionaryKey:@"NSMainNibFile"];
[NSBundle loadNibNamed:nib owner:NSApp];
[NSApp run];
[pool drain];
return 0;
}
and here are my errors:
2009-09-04 00:33:52.657 TestClient[90551:a0f] An uncaught exception
was raised
2009-09-04 00:33:52.659 TestClient[90551:a0f] *** -[NSBundle
initWithURL:]: non-file URL argument
2009-09-04 00:33:52.663 TestClient[90551:a0f] *** Terminating app
due to uncaught exception 'NSInvalidArgumentException', reason: '***
-[NSBundle initWithURL:]: non-file URL argument'
It doesn't seem to like the fact that the bundle URL is a directory,
but what else would it be?!
(and yes I have a webserver, and yes the URL is correct)
It's not complaining that the item is not a file (e.g. a directory).
It's complaining that the URL is not a file scheme URL.
It seems strange that you didn't recognize this, since this was
exactly what you were testing.
Regards,
Ken
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden