FXForms icon indicating copy to clipboard operation
FXForms copied to clipboard

FXFormFieldOptions: unrecognized selector crash

Open wm-j-ray opened this issue 9 years ago • 3 comments

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];
     }

wm-j-ray avatar May 27 '15 13:05 wm-j-ray

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.

lm2s avatar May 29 '15 15:05 lm2s

Same here. Will try to get the 1.2

csfelipe avatar Jun 01 '15 19:06 csfelipe

I believe 1.2.13 fixes this

barrettj avatar Jun 19 '15 13:06 barrettj