Any idea why such error when Apple Silicon enabled?
Too many arguments to function call, expected 0, have 3
On line id serializedObject = deserializedObjectFromObjectIMP( cls, @selector(deserializedObjectFromObject), [ dict objectForKey: @"object" ] );
NSString *className = [ dict objectForKey: @"class" ];
Class cls = NSClassFromString( [ self classNameForSerializedClassName: className ] );
if( cls == nil ){
[ NSException raise: NSInvalidArgumentException format: @"Cannot deserialize instances of class %@ : Class not found.", className ];
return nil;
}
IMP deserializedObjectFromObjectIMP = DMObjectSerializationFindImplementationForSelector( cls, @selector(deserializedObjectFromObject:) );
if( deserializedObjectFromObjectIMP == NULL ){
[ NSException raise: NSInvalidArgumentException format: @"Cannot deserialize instances of class %@ : Class does not respond to deserializedObjectFromObject.", className ];
return nil;
}
id serializedObject = deserializedObjectFromObjectIMP( cls, @selector(deserializedObjectFromObject), [ dict objectForKey: @"object" ] );
return serializedObject;
Too many arguments to function call, expected 0, have 3
On line id serializedObject = deserializedObjectFromObjectIMP( cls, @selector(deserializedObjectFromObject), [ dict objectForKey: @"object" ] );
(id)deserializedObjectFromDictionary: (NSDictionary *)dict
NSString *className = [ dict objectForKey: @"class" ];
Class cls = NSClassFromString( [ self classNameForSerializedClassName: className ] );
if( cls == nil ){
[ NSException raise: NSInvalidArgumentException format: @"Cannot deserialize instances of class %@ : Class not found.", className ];
return nil;
}
IMP deserializedObjectFromObjectIMP = DMObjectSerializationFindImplementationForSelector( cls, @selector(deserializedObjectFromObject:) );
if( deserializedObjectFromObjectIMP == NULL ){
[ NSException raise: NSInvalidArgumentException format: @"Cannot deserialize instances of class %@ : Class does not respond to deserializedObjectFromObject.", className ];
return nil;
}
id serializedObject = deserializedObjectFromObjectIMP( cls, @selector(deserializedObjectFromObject), [ dict objectForKey: @"object" ] );
return serializedObject;
Seems the definition of IMP has changed in the recent SDK.
(I'm not sure Apple Silicon has something to do with the change or not.)
You can try to declare the function type explicitly:
Please use the code formatter shown as < >.
(I'm not sure Apple Silicon has something to do with the change or not.)
You can try to declare the function type explicitly:
Code Block id (*_deserializedObjectFromObject_IMP)(id, SEL, id) = _DMObjectSerialization_FindImplementationForSelector( cls, @selector(_deserializedObjectFromObject:) );
Please use the code formatter shown as < >.