为什么pitchEnabled被视为私有API?

时间:2014-07-28 12:08:34

标签: ios ios7 appstore-approval iphone-privateapi

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以及避免这种情况的最佳方法是什么?

1 个答案:

答案 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);