在属性部分下的CLLocation Class Reference中,它为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.我只是好奇这是什么意思:@property(readonly, NS_NONATOMIC_IPHONEONLY)。具体地说就是NS_NONATOMIC_IPHONEONLY部分。在我看来,我可以通过iPod触摸屏访问它。
我是不是遗漏了什么?在iPod触摸屏上使用它安全吗?
发布于 2010-11-28 23:32:46
在across和iOS (née iPhone OS)之间共享CoreLocation。
这里,NS_NONATOMIC_IPHONEONLY只是指在iOS上是非原子的,在Mac上是原子的。这里的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
#endifhttps://stackoverflow.com/questions/4297477
复制相似问题