SwiftArchitect
SwiftArchitect

Reputation: 48542

The app references non-public selectors in Payload: hidden

I get this error when [Validating...] the iOS App in Xcode Organizer:

The app references non-public selectors in Payload/name.app/scheme: hidden.

However, hidden is a public property defined in UIView.h as:

@property(nonatomic,getter=isHidden) BOOL hidden;

What can cause the invocation of a public selector to fail Apple App Store validation?

Upvotes: 2

Views: 474

Answers (1)

SwiftArchitect
SwiftArchitect

Reputation: 48542

In short

Replaced:

[self addObserver:self
       forKeyPath:NSStringFromSelector(@selector(hidden))
          options:NSKeyValueObservingOptionNew
          context:nil];

by:

[self addObserver:self
       forKeyPath:@"hidden"
          options:NSKeyValueObservingOptionNew
          context:nil];

In details

In following NSHipster on KVO (Key-Value Observing), I used NSStringFromSelector(@selector(hidden)) for key path since, in truth, "...any typo or misspelling won't be caught by the compiler, and will cause things to not work."

As it turns out, the hidden property has an explicit getter, which is different from the property name:

@property(nonatomic,getter=isHidden) BOOL hidden;

I verified this with the opaque property as well.

@property(nonatomic,getter=isOpaque) BOOL opaque;

It too fails validation: The app references non-public selectors in Payload/name.app/scheme: opaque.

Upvotes: 1

Related Questions