Skip to content

Commit c783ed9

Browse files
Ignacio Romero ZurbuchenIgnacio Romero
authored andcommitted
Fixes incompatibility issues on iOS 8 causing crash. Oupsi.
1 parent bc5870c commit c783ed9

5 files changed

Lines changed: 33 additions & 22 deletions

File tree

Examples/Messenger-Programatic/Info.plist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,7 @@
4949
<string>UIInterfaceOrientationLandscapeLeft</string>
5050
<string>UIInterfaceOrientationLandscapeRight</string>
5151
</array>
52+
<key>UIViewControllerBasedStatusBarAppearance</key>
53+
<false/>
5254
</dict>
5355
</plist>

Examples/Messenger-Shared/MessageViewController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ - (void)simulateUserTyping:(id)sender
193193

194194
- (void)didLongPressCell:(UIGestureRecognizer *)gesture
195195
{
196-
#ifdef __IPHONE_9_0
196+
#ifdef __IPHONE_8_0
197197
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
198198
alertController.modalPresentationStyle = UIModalPresentationPopover;
199199
alertController.popoverPresentationController.sourceView = gesture.view.superview;

Examples/Messenger-Storyboard/Info.plist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,7 @@
5050
<string>UIInterfaceOrientationLandscapeLeft</string>
5151
<string>UIInterfaceOrientationLandscapeRight</string>
5252
</array>
53+
<key>UIViewControllerBasedStatusBarAppearance</key>
54+
<false/>
5355
</dict>
5456
</plist>

Examples/Messenger.xcodeproj/project.pbxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
71BE102F1A72F42F0083EE32 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4F86BF8E19F01234007A3D4A /* Images.xcassets */; };
4949
71BE10301A76C4890083EE32 /* MessageTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F7C6BA41A6E208E006E3FAB /* MessageTextView.m */; };
5050
8C6D809F3C95C912F87F0D17 /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DDFA9095EABC480682E6396C /* libPods.a */; };
51-
F5DE01401B9679C4005E9082 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4F86BF7619F011D0007A3D4A /* LaunchScreen.xib */; settings = {ASSET_TAGS = (); }; };
51+
F5DE01401B9679C4005E9082 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4F86BF7619F011D0007A3D4A /* LaunchScreen.xib */; };
5252
/* End PBXBuildFile section */
5353

5454
/* Begin PBXFileReference section */

Source/Classes/SLKTextViewController.m

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,7 @@ - (CGFloat)slk_topBarsHeight
425425
}
426426

427427
topBarsHeight += CGRectGetHeight([UIApplication sharedApplication].statusBarFrame);
428+
428429
return topBarsHeight;
429430
}
430431

@@ -2001,12 +2002,14 @@ - (UIKeyCommand *)slk_returnKeyCommand
20012002
UIKeyCommand *command = [UIKeyCommand keyCommandWithInput:@"\r" modifierFlags:0 action:@selector(didPressReturnKey:)];
20022003

20032004
#ifdef __IPHONE_9_0
2004-
// Only available since iOS 9
2005-
if (self.textInputbar.isEditing) {
2006-
command.discoverabilityTitle = [self.textInputbar.editorRightButton titleForState:UIControlStateNormal] ? : NSLocalizedString(@"Commit Editing", nil);
2007-
}
2008-
else if (self.textView.text.length > 0) {
2009-
command.discoverabilityTitle = [self.rightButton titleForState:UIControlStateNormal] ? : NSLocalizedString(@"Send", nil);
2005+
if ([UIKeyCommand respondsToSelector:@selector(keyCommandWithInput:modifierFlags:action:discoverabilityTitle:)] ) {
2006+
// Only available since iOS 9
2007+
if (self.textInputbar.isEditing) {
2008+
command.discoverabilityTitle = [self.textInputbar.editorRightButton titleForState:UIControlStateNormal] ? : NSLocalizedString(@"Commit Editing", nil);
2009+
}
2010+
else if (self.textView.text.length > 0) {
2011+
command.discoverabilityTitle = [self.rightButton titleForState:UIControlStateNormal] ? : NSLocalizedString(@"Send", nil);
2012+
}
20102013
}
20112014
#endif
20122015

@@ -2018,15 +2021,17 @@ - (UIKeyCommand *)slk_escKeyCommand
20182021
UIKeyCommand *command = [UIKeyCommand keyCommandWithInput:UIKeyInputEscape modifierFlags:0 action:@selector(didPressEscapeKey:)];
20192022

20202023
#ifdef __IPHONE_9_0
2021-
// Only available since iOS 9
2022-
if (self.isAutoCompleting) {
2023-
command.discoverabilityTitle = NSLocalizedString(@"Exit Auto-Completion", nil);
2024-
}
2025-
else if (self.textInputbar.isEditing) {
2026-
command.discoverabilityTitle = [self.textInputbar.editorRightButton titleForState:UIControlStateNormal] ? : NSLocalizedString(@"Exit Editing", nil);
2027-
}
2028-
else if (!self.isExternalKeyboardDetected && self.keyboardHC.constant != 0) {
2029-
command.discoverabilityTitle = NSLocalizedString(@"Hide Keyboard", nil);
2024+
if ([UIKeyCommand respondsToSelector:@selector(keyCommandWithInput:modifierFlags:action:discoverabilityTitle:)] ) {
2025+
// Only available since iOS 9
2026+
if (self.isAutoCompleting) {
2027+
command.discoverabilityTitle = NSLocalizedString(@"Exit Auto-Completion", nil);
2028+
}
2029+
else if (self.textInputbar.isEditing) {
2030+
command.discoverabilityTitle = [self.textInputbar.editorRightButton titleForState:UIControlStateNormal] ? : NSLocalizedString(@"Exit Editing", nil);
2031+
}
2032+
else if (!self.isExternalKeyboardDetected && self.keyboardHC.constant != 0) {
2033+
command.discoverabilityTitle = NSLocalizedString(@"Hide Keyboard", nil);
2034+
}
20302035
}
20312036
#endif
20322037

@@ -2039,11 +2044,13 @@ - (UIKeyCommand *)slk_arrowKeyCommand:(NSString *)inputUpArrow
20392044

20402045
#ifdef __IPHONE_9_0
20412046
// Only available since iOS 9
2042-
if ([inputUpArrow isEqualToString:UIKeyInputUpArrow]) {
2043-
command.discoverabilityTitle = NSLocalizedString(@"Move Up", nil);
2044-
}
2045-
if ([inputUpArrow isEqualToString:UIKeyInputDownArrow]) {
2046-
command.discoverabilityTitle = NSLocalizedString(@"Move Down", nil);
2047+
if ([UIKeyCommand respondsToSelector:@selector(keyCommandWithInput:modifierFlags:action:discoverabilityTitle:)] ) {
2048+
if ([inputUpArrow isEqualToString:UIKeyInputUpArrow]) {
2049+
command.discoverabilityTitle = NSLocalizedString(@"Move Up", nil);
2050+
}
2051+
if ([inputUpArrow isEqualToString:UIKeyInputDownArrow]) {
2052+
command.discoverabilityTitle = NSLocalizedString(@"Move Down", nil);
2053+
}
20472054
}
20482055
#endif
20492056

0 commit comments

Comments
 (0)