Ios 为什么pitchEnabled被视为私有API?
Xcode无法验证我的应用,因为 此应用程序引用有效负载中的非公共选择器/…:pitchEnabledIos 为什么pitchEnabled被视为私有API?,ios,ios7,appstore-approval,iphone-privateapi,Ios,Ios7,Appstore Approval,Iphone Privateapi,Xcode无法验证我的应用,因为 此应用程序引用有效负载中的非公共选择器/…:pitchEnabled #ifdef __IPHONE_7_0 if ([mapView respondsToSelector:@selector(pitchEnabled)]) { mapView.pitchEnabled = NO; mapView.rotateEnabled = NO; } #endif 将selector(pitchEnabled)替换为NSSelectorFromStrin
#ifdef __IPHONE_7_0
if ([mapView respondsToSelector:@selector(pitchEnabled)]) {
mapView.pitchEnabled = NO;
mapView.rotateEnabled = NO;
}
#endif
将
selector(pitchEnabled)
替换为NSSelectorFromString(@“pitchEnabled”)
解决了这个问题,但让我感觉不好,为什么pitchEnabled
被视为私有API,以及避免这种情况的最佳方法是什么?因为您是在检查方法而不是属性。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);
这是正确的想法,尽管Tuss试图使用setter而不是getter。@如果需要检查属性是否存在,这应该仍然有效。但您也可以检查
setPicthEnabled:
是否存在。