• 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: Checksum of App/NIB
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Checksum of App/NIB


  • Subject: Re: Checksum of App/NIB
  • From: Charles Srstka <email@hidden>
  • Date: Sat, 3 Aug 2002 13:58:27 -0500

On Saturday, August 3, 2002, at 10:28 AM, Itrat Khan wrote:

On Friday, August 3, 2001, at 10:56 AM, Luke Sands wrote:

So can someone tell me how to get a path to one of the class.nib /
info.nib etc which is in a nib bundle which is in my app bundle....


Your best bet is to load the desired nib file using NSFileWrapper and checksum the resulting NSData representation. To get the nib file, you can either hard-code it using NSBundle's pathForResource:@"mynib" ofType:@"nib" or use NSDirectoryEnumerator to search for all files in your application directory with a .nib extension.

Don't do this!

I tried that not long ago, and it turns out that if the path to the app changed, so did the data returned by -[NSFileWrapper serializedRepresentation]. So the app would work just fine in my build folder, but when I sent it to anyone else, the path it ended up in would not be the same, and they would get a checksum mismatch.

Just do this:

NSString *bundlePath = [[NSBundle mainBundle] pathForResource:@"mynib" ofType:@"nib"];
NSMutableData *nibData = [NSMutableData data];

[nibData appendData:[NSData dataWithContentsOfFile:
[bundlePath stringByAppendingPathComponent:@"classes.nib"]]];
[nibData appendData:[NSData dataWithContentsOfFile:
[bundlePath stringByAppendingPathComponent:@"info.nib"]]];
[nibData appendData:[NSData dataWithContentsOfFile:
[bundlePath stringByAppendingPathComponent:@"objects.nib"]]];

Then get a checksum on nibData.
_______________________________________________
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.

  • Follow-Ups:
    • Re: Checksum of App/NIB
      • From: Itrat Khan <email@hidden>
References: 
 >Re: Checksum of App/NIB (From: Itrat Khan <email@hidden>)

  • Prev by Date: Re: :_Two__Quick__Questions_
  • Next by Date: Re: Two Quick Questions…
  • Previous by thread: Re: Checksum of App/NIB
  • Next by thread: Re: Checksum of App/NIB
  • Index(es):
    • Date
    • Thread