PDA

View Full Version : Leopard update causes run-time error




guifa
Nov 11, 2007, 03:03 AM
When I updated to Leopard and rebuilt my app, I got the following error on launch which prevents windows that are set to be visible at launch from loading leaving me with an empty shell applicaiton running.

2007-11-11 09:36:20.380 HangmanCocoa[1268:10b] *** +[MSHangmanGameMode readableTypes]: unrecognized selector sent to class 0xf3e0
2007-11-11 09:36:20.381 HangmanCocoa[1268:10b] *** +[MSHangmanGameMode readableTypes]: unrecognized selector sent to class 0xf3e0
2007-11-11 09:36:20.382 HangmanCocoa[1268:10b] *** +[MSHangmanGameMode readableTypes]: unrecognized selector sent to class 0xf3e0
2007-11-11 09:36:20.383 HangmanCocoa[1268:10b] *** +[MSHangmanGameMode readableTypes]: unrecognized selector sent to class 0xf3e0

Did anyone else get a similar error? I don't call readableType (explicitely, at least) anywhere in my program and from the documentation it's an Apple method. I've still not yet been able to localize the error in my code, none of my initial loading methods seem to trigger it.



Eraserhead
Nov 11, 2007, 03:46 AM
Have you done a clean rebuild? What Mac OS X/XCode version did you upgrade from? Have you changed any target settings?

guifa
Nov 11, 2007, 04:10 AM
Have you done a clean rebuild? What Mac OS X/XCode version did you upgrade from? Have you changed any target settings?
I upgraded from the latest version of Tiger/XCode and opened the XCode project file, and just selected clean project, and then built it. So, in theory at least everything should be the same.

I've isolated every place in my code where the MSHangmanGameMode object could be instantiated and have surrounded it in NSLogs and none of them are picking up. The method it's trying to call is an Apple-supplied method that seems more internally useful rather than something that should be called by us.

Eraserhead
Nov 11, 2007, 11:58 AM
Is it possible to have a play with the code? I'll take a quick look tomorrow if I have time.

Krevnik
Nov 11, 2007, 12:14 PM
I upgraded from the latest version of Tiger/XCode and opened the XCode project file, and just selected clean project, and then built it. So, in theory at least everything should be the same.

I've isolated every place in my code where the MSHangmanGameMode object could be instantiated and have surrounded it in NSLogs and none of them are picking up. The method it's trying to call is an Apple-supplied method that seems more internally useful rather than something that should be called by us.

NSHangmanGameMode is your NSDocument sub-class?

guifa
Nov 11, 2007, 08:25 PM
NSHangmanGameMode is your NSDocument sub-class?

No... The NSDocument loads before a game an MSHangmanGameMode and an MSHangmanLanguage which controls how the words are chosen and which alphabet/script etc is used. However, the NSDoc doesn't get to the point of loading it when it errors out.

Krevnik
Nov 11, 2007, 11:09 PM
No... The NSDocument loads before a game an MSHangmanGameMode and an MSHangmanLanguage which controls how the words are chosen and which alphabet/script etc is used. However, the NSDoc doesn't get to the point of loading it when it errors out.

readableTypes is only meant for NSDocument and its subclasses. If it is calling it on your HangmanGameMode class, I would look at your Info.plist file and make sure it points at your NSDocument subclass.

guifa
Nov 12, 2007, 03:48 AM
readableTypes is only meant for NSDocument and its subclasses. If it is calling it on your HangmanGameMode class, I would look at your Info.plist file and make sure it points at your NSDocument subclass.

That was exactly what it was. XCode didn't warn me it was changing anything on opening it in the new version but sure enough:

<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>hangmanGameMode</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>GameModeIcon</string>
<key>CFBundleTypeName</key>
<string>GameMode</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSTypeIsPackage</key>
<true/>
<key>NSDocumentClass</key>
<string>MSHangmanGameMode</string>
<key>NSPersistentStoreTypeKey</key>
<string>XML</string>
</dict>

Krevnik
Nov 12, 2007, 05:33 PM
That was exactly what it was. XCode didn't warn me it was changing anything on opening it in the new version but sure enough:


I am not 100% sure it was XCode changing it, per se. Then again, I haven't migrated any big project and had it fail yet.

Some environment variables might change, but in general, it seems odd that sort of entry would change at all. XCode only needs to set it once when the project is created. The only time anyone should be changing that value is when a programmer does it.

guifa
Nov 12, 2007, 07:00 PM
I am not 100% sure it was XCode changing it, per se. Then again, I haven't migrated any big project and had it fail yet.

Some environment variables might change, but in general, it seems odd that sort of entry would change at all. XCode only needs to set it once when the project is created. The only time anyone should be changing that value is when a programmer does it.
My other projects (though much smaller) migrated okay as far as I can tell so far. Just those two Info.plist (it did it as well to the other bundle class) entries. Anyways everything is now running okay so now maybe I can finally finish this project up now that there's no more school, exams, papers, or anything else to get in my way :)