IPod: What does NS_NONATOMIC_IPHONEONLY mean? Can I use this feature on iPod Touch?

Inside CLLocation Class Referencethe properties section, this is 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 just wonder what it means @property(readonly, NS_NONATOMIC_IPHONEONLY). In particular, part NS_NONATOMIC_IPHONEONLY. It seems to me that I can access this from iPod touch.

Am I missing something? Is it safe to use with iPod touch?

+3
source share
1 answer

CoreLocation is used for both Mac OS X and iOS (née iPhone OS).

This NS_NONATOMIC_IPHONEONLYmeans that decency is not atomic for iOS and atom in Mac OS X. The iPhone here refers only to iOS, not to the iPhone and 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
+5

Source: https://habr.com/ru/post/1777304/


All Articles