iPod: NS_NONATOMIC_IPHONEONLY 是什么意思?在 iPod Touch 上使用这样的属性安全吗?

发布于 2024-10-05 00:51:18 字数 701 浏览 2 评论 0原文

在属性部分下的 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 使用此功能安全吗?

Inside the CLLocation Class Reference under the properties section this what it says for coordinate:

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.

I am just curious what this means: @property(readonly, NS_NONATOMIC_IPHONEONLY). Specifically the NS_NONATOMIC_IPHONEONLY part. It seems to me that I can access this from an iPod touch.

Am I missing something? Is it safe to use this from an iPod touch?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

此生挚爱伱 2024-10-12 00:51:18

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

CoreLocation is shared across both Mac OS X and iOS (née iPhone OS).

Here, NS_NONATOMIC_IPHONEONLY only means that the propriety is nonatomic on iOS and atomic on Mac OS X. The iPhone here is only referring to iOS, not iPhone vs iPod touch.

It is defined in TargetConditionals.h as this.

// 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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文