Skip to content
This repository has been archived by the owner on Oct 19, 2023. It is now read-only.

Commit

Permalink
Modify sharedApplication call to avoid extension error (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
ianegordon authored Sep 8, 2017
1 parent b9a0bcd commit 902e392
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Sources/UIView+MaterialRTL.m
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ + (UIUserInterfaceLayoutDirection)mdf_userInterfaceLayoutDirectionForSemanticCon
NSString *bundlePath = [[NSBundle mainBundle] bundlePath];
// Can I use kAppBundleIdentifier ?
if ([bundlePath hasSuffix:@".app"]) {
applicationLayoutDirection = [UIApplication sharedApplication].userInterfaceLayoutDirection;
// We can't call sharedApplication directly or an error gets thrown for app extensions.
UIApplication *application =
[[UIApplication class] performSelector:@selector(sharedApplication)];
applicationLayoutDirection = application.userInterfaceLayoutDirection;
}
return [self
mdf_userInterfaceLayoutDirectionForSemanticContentAttribute:attribute
Expand Down

0 comments on commit 902e392

Please sign in to comment.