FXForms
FXForms copied to clipboard
FXFormFieldOptions: unrecognized selector crash
Nick,
I all of a sudden started getting crashes on FXFormFieldOptions on my code. I sync'ed with github and ran the CustomFormControllerExample and am getting the same crash:
Here is the field definition:
@{FXFormFieldKey: @"country",
FXFormFieldOptions: @[@"us", @"ca", @"gb", @"sa", @"be"],
FXFormFieldValueTransformer: [[ISO3166CountryValueTransformer alloc] init]},
The error thrown:
2015-05-27 09:20:25.567 CustomFormControllerExample[3880:432015] -[__NSCFBoolean objectForKeyedSubscript:]: unrecognized selector sent to instance 0x111755c00
And the exception breakpoint revealed (line 927 of FXForms.m
- (id)valueForUndefinedKey:(NSString *)key
{
return _cellConfig[key];
}
I'm not sure, but the only thing I can think of that may have changed is 363 the BaseModel merge. Would these lines affect anything?
{
_form = form;
_formController = formController;
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wselector"
- if (FXFormCanGetValueForKey(form, @"field")
- && FXFormCanGetValueForKey(form, @"field.cellConfig")
- && [[form performSelector:@selector(field)] performSelector:@selector(cellConfig)]) {
- _cellConfig = [[form performSelector:@selector(field)] performSelector:@selector(cellConfig)];
-#pragma clang diagnostic pop
+ BOOL canGetField = FXFormCanGetValueForKey(form, @"field");
+ BOOL canGetFieldConfig = FXFormCanGetValueForKey(form, @"field.cellConfig");
+ NSObject *typedObj = form;
+ id formField = canGetField ? [typedObj valueForKey:@"field"] : nil;
+ if (formField && formFieldConfig) {
+ _cellConfig = formFieldConfig;
} else {
_cellConfig = [NSMutableDictionary dictionary];
}
I don't have anything to add, but I'm experiencing the same crash. As a temporary fix I've returned to 1.2 and everything seems to be working fine.
Same here. Will try to get the 1.2
I believe 1.2.13 fixes this