Having just spent the best part of a day trying to troubleshoot the very first source code in the “Core Data” book (Chapter 2 - GrokkingRecipes v1…!?), I’ve learned that the code compiles and runs fine in OS X 10.5, and the problems I’ve been having ONLY occur in OS X 10.6.
Specifically, the simple core data app is designed to allow you to import an imagePath whereupon the code copies an image file to a support folder and stores the path in the data model - I faithfully reproduced each of the steps and everything worked well except for the image import function. Nearly(!?) every time I imported an image, the app crashed straight after the NSOpenPanel object closed - presumably at the point the model is adding the new image path. The console information was not that helpful, and I’m not familiar enough with XCode to know more detailed ways of debugging. For what its worth, here is the console output:
[Session started at 2009-09-10 15:09:54 +1000.] GNU gdb 6.3.50-20050815 (Apple version gdb-1344) (Fri Jul 3 01:19:56 UTC 2009) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "x86_64-apple-darwin".tty /dev/ttys000 Loading program into debugger… Program loaded. run [Switching to process 26500] Running… Program received signal: “EXC_BAD_ACCESS”. sharedlibrary apply-load-rules all
Anyway, after some fruitless error checking, I downloaded the complete app from the supplied source code and it ran fine - in OS X 10.5, but the same errors occurred if I tried to recompile in 10.6.
So, is anyone aware of what may have changed in the Snow Leopard update?
I had to change a couple of lines of code that had been deprecated in the 10.6 SDK in order for it to compile without errors or warnings - namely:
[[NSFileManager defaultManager] copyPath:path toPath:destPath handler:nil];
NSError *error = nil; [[NSFileManager defaultManager] copyItemAtPath:path toPath:destPath error:&error];
…but otherwise no change.
Any thoughts would be appreciated.