Open davidrothera opened 9 years ago
That doesn't make a whole lot of sense. self.fields is functionally equivalent to [self fields]. Can you explain what effect you believe this change had on the behavior?
The basis behind my change was that calling self.fields
accesses the instance variable which could be nil however using the [self fields]
method[1] will instantiate a non-existing instance variable.
[1] https://github.com/davidrothera/FXForms/blob/develop/FXForms/FXForms.m#L1732
But self.fields
doesn't access the instance variable. It calls the - (NSMutableArray *)fields
method. To access the instance variable, you'd have to write self->_fields
.
Try putting a breakpoint inside - (NSMutableArray *)fields
and you can verify that it's called when you access self.fields
.
I think perhaps the issue that you're referring to is "Argument to 'NSMutableArray' method 'addObject;:' cannot be nil"? In which case the issue it's complaining about is that the field
value being added to the array is nil, not the array itself.
I'll fix this in the next update.
Yeah I think you are right, its strange though as making the change in the PR resolved the clang error and retained all functionality.
Hmm, I can't actually replicate a clang warning on the line you fixed. The warning I'm seeing is on the line a few below that: [self.fields addObject:field]
Yes, the error was on that line and the change I made resolved that one lower down.
I think maybe the change above just confused the analyzer so that it couldn't parse the logic below anymore ¯(ツ)/¯
Quite possibly, clang isn't the smartest ;)
Changes
resignFirstResponder
calls to the superclassself.fields
to[self fields]
which allows the array to be initiated if it isn't alreadyFixes
Fixes #365
Testing