gpt4 book ai didi

iphone - iPod : What does NS_NONATOMIC_IPHONEONLY mean? 在 iPod Touch 上使用此类属性是否安全?

转载 作者:行者123 更新时间:2023-12-03 19:40:21 24 4
gpt4 key购买 nike

在属性部分下的CLLocation类引用内,它表示坐标:

coordinate
The geographical coordinate information. (read-only)

@property(readonly, NS_NONATOMIC_IPHONEONLY) CLLocationCoordinate2D coordinate
Discussion
When running in the simulator, Core Location assigns a fixed set of coordinate values to this property. You must run your application on an iOS-based device to get real location values.

Special Considerations
In iOS, this property is declared as nonatomic. In Mac OS X, it is declared as atomic.

我只是好奇这意味着什么:@property(readonly, NS_NONATOMIC_IPHONEONLY)。特别是 NS_NONATOMIC_IPHONEONLY 部分。在我看来,我可以通过 iPod touch 访问此内容。

我错过了什么吗?从 iPod touch 使用此功能安全吗?

最佳答案

CoreLocation 在 Mac OS X 和 iOS(née iPhone OS)之间共享。

这里,NS_NONATOMIC_IPHONEONLY仅表示该属性在 iOS 上是非原子的,在 Mac OS X 上是原子的。这里的 iPhone 仅指 iOS,而不是 iPhone 与 iPod touch。

它在 TargetConditionals.h 中定义如下。

// Marks APIs whose iPhone versions are nonatomic, that is cannot be set/get from multiple threads safely without additional synchronization
#if !defined(NS_NONATOMIC_IPHONEONLY)
#if TARGET_OS_IPHONE
#define NS_NONATOMIC_IPHONEONLY nonatomic
#else
#define NS_NONATOMIC_IPHONEONLY
#endif
#endif

关于iphone - iPod : What does NS_NONATOMIC_IPHONEONLY mean? 在 iPod Touch 上使用此类属性是否安全?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4297477/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com