• 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: load a NIB from NSData
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: load a NIB from NSData


  • Subject: Re: load a NIB from NSData
  • From: Ondra Cada <email@hidden>
  • Date: Wed, 12 Jun 2002 20:11:41 +0200

On Wednesday, June 12, 2002, at 07:32 , Timothy Ritchey wrote:

NIB file that has been loaded into an NSData object...

How? NIB is actually a folder, containing (normally) three different files!

That is a bloody good question. This little ditty:

NSBundle *mBundle = [NSBundle mainBundle];
NSString *path = [mBundle pathForResource:@"test" ofType:@"nib"];
data = [NSData dataWithContentsOfFile:path];

wasn't throwing an error

Quite properly, at that. As docs say, all those foobarWithContentsOfFile: methods merrily return nil if they can't fulfill the request; they don't throw (nor raise, which would be a more proper term in ObjC/Foundation). Thus...

, but after reading your e-mail, when I added this line:

NSLog([NSString stringWithFormat:@"%@: %d", path, [data length]]);

I was greeted with a zero data length.

...I'd bet you actually got nil in data (which among others ensures that [data whatever] returns zero).

I never checked it, because I was still trying to figure out how to load it on the other end. I forgot that a nib was in fact a folder. Perhaps I am barking up the wrong tree entirely.

Depends on what you are actually trying to do. Just to move any folder to another system I would probably use gnutar (launched via NSTask) on both sides to pack/unpack (with the added benefit of comprimation), and then indeed send it via NSData. There are other possibilities of course (like using a HTTP request via NSURL, in case the "vendor" happens to have Apache activated)...
---
Ondra Cada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: 
 >Re: load a NIB from NSData (From: Timothy Ritchey <email@hidden>)

  • Prev by Date: Re: -[NSResponder flagsChanged:] not called?
  • Next by Date: Re: copyPath and FilePackages
  • Previous by thread: Re: load a NIB from NSData
  • Next by thread: Re: load a NIB from NSData
  • Index(es):
    • Date
    • Thread