-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix build on OS X #159
Fix build on OS X #159
Conversation
No longer necessary after pull requests CocoaLumberjack#121 and CocoaLumberjack#156, and more importantly, that was ugly.
Came up with three cases: a) Newer SDK's (iOS 7+/OS X 10.9+) on newer (iOS 7.0+/OS X 10.9+) runtime b) Systems where dispatch_get_current_queue is not yet deprecated and won't crash (< iOS 6.0/OS X 10.9)
c) Give up Any comments? @robbiehanson, @bpoplauschi, @kolyuchiy, @sprhawk? |
I think DISPATCH_CURRENT_QUEUE_LABEL is not defined for OS X |
From /*!
* @const DISPATCH_CURRENT_QUEUE_LABEL
* @discussion Constant to pass to the dispatch_queue_get_label() function to
* retrieve the label of the current queue.
*/
#define DISPATCH_CURRENT_QUEUE_LABEL NULL
/*!
* @function dispatch_queue_get_label
*
* @abstract
* Returns the label of the given queue, as specified when the queue was
* created, or the empty string if a NULL label was specified.
*
* Passing DISPATCH_CURRENT_QUEUE_LABEL will return the label of the current
* queue.
*
* @param queue
* The queue to query, or DISPATCH_CURRENT_QUEUE_LABEL.
*
* @result
* The label of the queue.
*/
__OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_0)
DISPATCH_EXPORT DISPATCH_PURE DISPATCH_WARN_RESULT DISPATCH_NOTHROW
const char *
dispatch_queue_get_label(dispatch_queue_t queue); |
I can't find it. Could you try building Xcode/LumberjackFramework/Desktop just to be sure? |
// a) Compiling against newer SDK's (iOS 7+/OS X 10.9+) where DISPATCH_CURRENT_QUEUE_LABEL is defined | ||
// on a (iOS 7.0+/OS X 10.9+) runtime version | ||
BOOL gotLabel = NO; | ||
#ifdef DISPATCH_CURRENT_QUEUE_LABEL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It builds, but it would anyway because of this check.
You're correct. I meant to say that because DISPATCH_CURRENT_QUEUE_LABEL doesn't exist on Mac OS, the Mac path from case a) is never executed. If you see DISPATCH_CURRENT_QUEUE_LABEL defined on Mac, could you tell me in which file? |
Disregard my last comment. I just saw your definition of DISPATCH_CURRENT_QUEUE_LABEL. I'm still running Mountain Lion, that's why it's undefined for me. |
I'll have to leave now but you and @kolyuchiy can work directly on this pull request if you feel like (added you as collaborators in the fork). |
@rivera-ernesto The pull request sounds right to me. I will go ahead and merge it. |
@robbiehanson @kolyuchiy @sprhawk you guys should still review and comment |
#if TARGET_OS_IPHONE | ||
[[[UIDevice currentDevice] systemVersion] compare:@"7.0" options:NSNumericSearch] != NSOrderedAscending // 7.0+ | ||
#else | ||
[[NSApplication sharedApplication] respondsToSelector:@selector(occlusionState)] // No nice way to check for OS X 10.9+ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this bug actually reproduces on Mac OS? Maybe we don't have to check and just use dispatch_queue_get_label(currentQueue)?
I think that avoiding deprecated methods is good even if they don't crash on OS X. |
#156 and #121 were not tested on OS X.