• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSBundle from an URL.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >NSBundle from an URL. (From: Erik Ă–sterlund <email@hidden>)

  • Prev by Date: Re: NSBundle from an URL.
  • Next by Date: Crash in CFRunLoopWakeUp
  • Previous by thread: Re: NSBundle from an URL.
  • Next by thread: Re: NSBundle from an URL.
  • Index(es):
    • Date
    • Thread