New: nib2cib gives a more helpful message when unsupported classes are encountered.

Previously users saw the generic "-[CPKeyedUnarchiver decodeObjectForKey:]: cannot decode object of class (NSFoo)" message, which was not particularly instructive.

Now the message is: "NSFoo objects are not supported by nib2cib."

Closes #1923
This commit is contained in:
Aparajita Fishman committed 2013-05-09 07:35:27 -04:00
1 parent 01291591b7
commit a63bb155c2
1 file changed
+13 -2
+13 -2
View File
@@ -31,8 +31,11 @@
- (void)convertedDataFromMacData:(CPData)data
{
// Unarchive the NS data
var unarchiver = [[Nib2CibKeyedUnarchiver alloc] initForReadingWithData:data],
objectData = [unarchiver decodeObjectForKey:@"IB.objectdata"],
var unarchiver = [[Nib2CibKeyedUnarchiver alloc] initForReadingWithData:data];
[unarchiver setDelegate:self];
var objectData = [unarchiver decodeObjectForKey:@"IB.objectdata"],
objects = [unarchiver allObjects],
count = [objects count];
@@ -60,6 +63,14 @@
return convertedData;
}
- (Class)unarchiver:(CPKeyedUnarchiver)unarchiver cannotDecodeObjectOfClassName:(CPString)name originalClasses:(CPArray)classNames
{
// The CPKeyedUnarchiver exception message is accurate, but not that helpful to nib2cib users.
// We will raise our own exception.
[CPException raise:CPInvalidUnarchiveOperationException format:@"%@ objects are not supported by nib2cib.", name];
}
- (void)replaceFontForObject:(id)object
{
if ([object respondsToSelector:@selector(font)] &&