-
Notifications
You must be signed in to change notification settings - Fork 118
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
Makes the [UIApplication sharedApplication] call only if possible #29
Conversation
Great! Are you currently using it within an extension? |
I have a framework in my project which is used in both iOS app and the today extension, the framework has BFKit as a dependency. The project did not compile due to |
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.
Let's discuss the other piece of code, and then check the Allow app extension API only
in the Xcode project.
|
||
if ((NSFoundationVersionNumber <= NSFoundationVersionNumber_iOS_7_1) && UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)) { | ||
|
||
UIInterfaceOrientation orientation = UIInterfaceOrientationPortrait; |
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.
Please use spaces instead of tabs.
if ((NSFoundationVersionNumber <= NSFoundationVersionNumber_iOS_7_1) && UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)) { | ||
|
||
UIInterfaceOrientation orientation = UIInterfaceOrientationPortrait; | ||
if([UIApplication instancesRespondToSelector:@selector(sharedApplication)]){ |
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.
I found a more useful piece of code:
Class UIApplicationClass = NSClassFromString(@"UIApplication");
if(!UIApplicationClass || ![UIApplicationClass respondsToSelector:@selector(sharedApplication)]) {
orientation = [[[UIApplication class] performSelector:@selector(sharedApplication)] statusBarOrientation];
}
What do you think?
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation; | ||
|
||
|
||
UIInterfaceOrientation orientation = UIInterfaceOrientationPortrait; |
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.
Same as UIScreen+BFKit.m
.
I think the changes make sense, I will make the changes! |
News about it? 😄 |
Made the changes requested! Sorry for the delay. |
Thanks and don't worry about the delay 😉 |
[UIApplication sharedApplication]
call breaks in the extensions, the change allows the library to be included in extensions without problems.