Xcode无法验证我的应用,因为
此应用引用了Payload /...中的非公开选择器。: pitchEnabled
#ifdef __IPHONE_7_0
if ([mapView respondsToSelector:@selector(pitchEnabled)]) {
mapView.pitchEnabled = NO;
mapView.rotateEnabled = NO;
}
#endif
用selector(pitchEnabled)
替换NSSelectorFromString(@"pitchEnabled")
解决了这个问题但让我觉得很脏,为什么pitchEnabled
被视为私有API以及避免这种情况的最佳方法是什么?
答案 0 :(得分:1)
因为您要检查方法而不是属性。并且getter方法为isPitchEnabled
而非pitchEnabled
。
// Rotate and pitch are enabled by default on Mac OS X and on iOS 7.0 and later.
@property (nonatomic, getter=isRotateEnabled) BOOL rotateEnabled NS_AVAILABLE(10_9, 7_0);
@property (nonatomic, getter=isPitchEnabled) BOOL pitchEnabled NS_AVAILABLE(10_9, 7_0);