Value of UIBackgroundTaskInvalid is?
I read from the header file (UIApplication.h):
typedef NSUInteger UIBackgroundTaskIdentifier;
UIKIT_EXTERN const UIBackgroundTaskIdentifier UIBackgroundTaskInvalid __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_4_0);
It seems that UIBackgrou开发者_运维知识库ndTaskInvalid is just an ordinary NSUInteger with a given value. Now that I'm writing code that has to be compatible with jailbreaking iOS 3.1.3 (where UIBackgroundTaskInvalid is not defined yet). I might need the real value behind it. Anyone can help?
Thanks in advance.
Di
You can check it with
#if !defined UIBackgroundTaskIdentifier
// Pre iOS 4 Fallback
#endif
The sample above only checks the value on compile time. If you need these kind of checks on run-time you can check this great article.
精彩评论