Xcode无法验证我的应用,因为
此应用引用有效载荷/ ...中的非 public 选择器: pitchEnabled
#ifdef __IPHONE_7_0
if ([mapView respondsToSelector:@selector(pitchEnabled)]) {
mapView.pitchEnabled = NO;
mapView.rotateEnabled = NO;
}
#endif
用
selector(pitchEnabled)
替换NSSelectorFromString(@"pitchEnabled")
解决了此问题,但让我感到肮脏,为什么pitchEnabled
被视为 private 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);
关于ios - 为什么将pitchEnabled视为私有(private)API?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/24994935/