Skip to content

Commit 49a7ed7

Browse files
authored
Fix FCM build warning introduced in Xcode 9 (#546)
1 parent 3418244 commit 49a7ed7

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

Firebase/Messaging/FIRMessaging.m

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,6 @@ - (void)handleIncomingLinkIfNeededFromMessage:(NSDictionary *)message {
384384
id<UIApplicationDelegate> appDelegate = application.delegate;
385385
SEL continueUserActivitySelector =
386386
@selector(application:continueUserActivity:restorationHandler:);
387-
SEL openURLWithOptionsSelector = @selector(application:openURL:options:);
388387
SEL openURLWithSourceApplicationSelector =
389388
@selector(application:openURL:sourceApplication:annotation:);
390389
SEL handleOpenURLSelector = @selector(application:handleOpenURL:);
@@ -403,7 +402,7 @@ - (void)handleIncomingLinkIfNeededFromMessage:(NSDictionary *)message {
403402
// Do nothing, as we don't support the app calling this block
404403
}];
405404

406-
} else if ([appDelegate respondsToSelector:openURLWithOptionsSelector]) {
405+
} else if (@available(iOS 9.0, *)) {
407406
[appDelegate application:application openURL:url options:@{}];
408407

409408
// Similarly, |application:openURL:sourceApplication:annotation:| will also always be called, due
@@ -727,7 +726,7 @@ - (void)setAPNSToken:(NSData *)apnsToken error:(NSError *)error {
727726

728727
- (void)receiver:(FIRMessagingReceiver *)receiver
729728
receivedRemoteMessage:(FIRMessagingRemoteMessage *)remoteMessage {
730-
if ([self.delegate respondsToSelector:@selector(messaging:didReceiveMessage:)]) {
729+
if (@available(iOS 10.0, *)) {
731730
[self.delegate messaging:self didReceiveMessage:remoteMessage];
732731
} else if ([self.delegate respondsToSelector:@selector(applicationReceivedRemoteMessage:)]) {
733732
#pragma clang diagnostic push

Firebase/Messaging/FIRMessagingContextManagerService.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ + (void)scheduleLocalNotificationForMessage:(NSDictionary *)message
143143
}
144144
if ([apsDictionary[kFIRMessagingContextManagerTitleKey] length]) {
145145
// |alertTitle| is iOS 8.2+, so check if we can set it
146-
if ([notification respondsToSelector:@selector(setAlertTitle:)]) {
146+
if (@available(iOS 8.2, *)) {
147147
notification.alertTitle = apsDictionary[kFIRMessagingContextManagerTitleKey];
148148
}
149149
}

Firebase/Messaging/FIRMessagingRmq2PersistentStore.m

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,13 @@
104104

105105
// Utility to create an NSString from a sqlite3 result code
106106
NSString * _Nonnull FIRMessagingStringFromSQLiteResult(int result) {
107-
const char *errorStr = sqlite3_errstr(result);
108-
NSString *errorString = [NSString stringWithFormat:@"%d%s", result, errorStr];
109-
return errorString;
107+
const char *errorStr;
108+
if (@available(iOS 8.2, *)) {
109+
errorStr = sqlite3_errstr(result);
110+
} else {
111+
errorStr = "pre iOS 8.2";
112+
}
113+
return [NSString stringWithFormat:@"%d%s", result, errorStr];
110114
}
111115

112116
@interface FIRMessagingRmq2PersistentStore () {

0 commit comments

Comments
 (0)