0

i have Just In time property, which was working fine but now xcode 11.4 started complaining about it. please look at following code

- (UITextField *)searchTextField
{
    if (!_searchTextField)
    {
        _searchTextField = [self firstSubViewOfKindOfClass:[UITextField class]];
    }
    return _searchTextField;
}

Error :Use of undeclared identifier '_searchTextField'

i have a property defined for it like below

@property (nonatomic, strong) UITextField  *searchTextField;
Shaik Riyaz
  • 11,204
  • 7
  • 53
  • 70

1 Answers1

1

You have a name clash. You cannot define a searchTextField because there already is a searchTextField (in iOS 13):

https://developer.apple.com/documentation/uikit/uisearchbar/3175433-searchtextfield

So you could just delete your code, as it isn't needed in iOS 13. Or if you need to support iOS 12 and earlier, you could give your property a different name that doesn't clash.

matt
  • 515,959
  • 87
  • 875
  • 1,141
  • I’m not clear on that, but it seems to be similar to https://stackoverflow.com/questions/60870129/snapshotting-a-uiview-crashes-the-app-with-nsinvalidargumentexception-uir/60871913#60871913. The Cocoa namespace, or the nature of its exposure, seems to have changed. – matt Mar 28 '20 at 13:16