I'm writing a simple throw away program to transform data format from a text file to a text file. I decided to use a Cocoa Document class for practice, instead of (for example) perl.
Using -readFromData:ofType:Error: storing the data as a string, and then converting the string works fine (except the program just stalls afterwards) and has to be killed. In trying to track this down, I put a bunch of NSLog's in, and ended up with this (boiler plate comments ommitted): __ - (BOOL)readFromData:(NSData *)data ofType:(NSString *)typeName error:(NSError **)outError { NSLog(@"readFromData has been called, typeName is: %...@\n", typeName); if ( outError != NULL ) { NSLog(@"outError is not null"); NSLog(@"Going to call NSError\n"); *outError = [NSError errorWithDomain:NSOSStatusErrorDomain code:unimpErr userInfo:NULL]; NSLog(@"Read error -- outError is: %...@\n\n", *outError); [self setInputData:[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]]; [self convertData]; return NO; } "convertData" is the method that does the format conversion. It has ample NSLog statments so I can see that it is being converted properly. My debug console gives: 2009-08-13 13:44:50.376 TransformKaiser[1419:10b] readFromData has been called, typeName is: Kiaser History Convert 2009-08-13 13:44:50.378 TransformKaiser[1419:10b] outError is not null 2009-08-13 13:44:50.378 TransformKaiser[1419:10b] Going to call NSError 2009-08-13 13:44:50.380 TransformKaiser[1419:10b] Read error -- outError is: Error Domain=NSOSStatusErrorDomain Code=-4 "Operation could not be completed. (OSStatus error -4.)" ( / / unimplemented core routine) (Could have spelled Kaiser correctly, but what the heck, this was supposed to be a one run throw away program.) and I get an alert message that says: "The document “testFile.txt” could not be opened." I suppose this is due to returning NO. But what is the unimplemented core routine? I'm using Xcode 3.1.3, on OS X 10.5.8, Intel core 2 duo. My active architecture is i386, sdk is 10.5, build configuration is Debug. Thanks, John Velman _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com