NSBundle from an URL.
NSBundle from an URL.
- Subject: NSBundle from an URL.
- From: Erik Ă–sterlund <email@hidden>
- Date: Fri, 4 Sep 2009 00:36:33 +0200
Hello.
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)
- Fisk
_______________________________________________
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