• 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: Problem using filewrappers under snow leopard
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem using filewrappers under snow leopard


  • Subject: Re: Problem using filewrappers under snow leopard
  • From: Eagle Offshore <email@hidden>
  • Date: Wed, 07 Oct 2009 09:33:57 -0700

Oops, I misspoke. I am doing it "right" AFAICS. Here's the whole method

- (NSFileWrapper *)fileWrapperOfType:(NSString *)aType error: (NSError**)errPtr
{
int i, count = [_songs count];
NSMutableDictionary * fileWrappers = [NSMutableDictionary dictionaryWithCapacity:count + 1];
[fileWrappers setObject:[[NSFileWrapper alloc] initRegularFileWithContents:[self setData]] forKey:@"Sets.plist"];
for(i = 0; i < count; ++i)
{
JBSong* song = [_songs objectAtIndex: i];
[fileWrappers setObject: [[NSFileWrapper alloc] initRegularFileWithContents:[song asData]] forKey: [[song fileName] stringByAppendingString: @".sng"]];
[fileWrappers setObject: [[NSFileWrapper alloc] initRegularFileWithContents:[song lyricData]] forKey: [[song fileName] stringByAppendingString: @".rtf"]];
}
[fileWrappers setObject: [[NSFileWrapper alloc] initRegularFileWithContents:[NSKeyedArchiver archivedDataWithRootObject: _midiController]] forKey: @"Midi.map"];
return [[NSFileWrapper alloc] initDirectoryWithFileWrappers:fileWrappers];
}


And as I said, this worked in Tiger, and Leopard, and only now it has a problem in Snow Leopard and the problem seems to be deep in framework code. A console log message giving a clue to the cause of the error would not be out of line, Apple.

On Oct 6, 2009, at 5:47 PM, Graham Cox wrote:


On 07/10/2009, at 11:23 AM, Eagle Offshore wrote:

where fileWrappers is an NSMutableDictionary of filename->NSData's.


But that's not what the documentation says you should pass. The dictionary should contain other NSFileWrappers keyed by their preferred filenames, not NSData. That you got away with it in the past is a fluke.


Initializes the receiver as a directory file wrapper, with a given file-wrapper list.

- (id)initDirectoryWithFileWrappers:(NSDictionary *) childrenByPreferredName

Parameters
childrenByPreferredName
Key-value dictionary of file wrappers with which to initialize the receiver. The dictionary must contain entries whose values are the file wrappers that are to become children and whose keys are filenames. See Working With Directory Wrappers in Application File Management for more information about the file-wrapper list structure.


Return Value
Initialized file wrapper for fileWrappers.




--Graham



_______________________________________________

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


  • Follow-Ups:
    • Re: Problem using filewrappers under snow leopard
      • From: Graham Cox <email@hidden>
    • Re: Problem using filewrappers under snow leopard
      • From: Ken Thomases <email@hidden>
References: 
 >Problem using filewrappers under snow leopard (From: Eagle Offshore <email@hidden>)
 >Re: Problem using filewrappers under snow leopard (From: Graham Cox <email@hidden>)

  • Prev by Date: strange localization issue
  • Next by Date: Re: Triggering a Method when a Core Data Property is Altered.
  • Previous by thread: Re: Problem using filewrappers under snow leopard
  • Next by thread: Re: Problem using filewrappers under snow leopard
  • Index(es):
    • Date
    • Thread