Skip to content

Commit a5ce374

Browse files
committed
Mute FCM deprecated warnings with Xcode 11 and min iOS >= 10 (#3857)
1 parent 67a5ea3 commit a5ce374

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

Example/Messaging/Tests/FIRMessagingContextManagerServiceTest.m

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,10 @@ - (void)testMessageWithFutureStartTime {
8383
XCTAssertTrue([FIRMessagingContextManagerService handleContextManagerMessage:message]);
8484

8585
XCTAssertEqual(self.scheduledLocalNotifications.count, 1);
86-
86+
#pragma clang diagnostic push
87+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
8788
UILocalNotification *notification = [self.scheduledLocalNotifications firstObject];
89+
#pragma clang diagnostic pop
8890
NSDate *date = [self.dateFormatter dateFromString:startTimeString];
8991
XCTAssertEqual([notification.fireDate compare:date], NSOrderedSame);
9092
#endif
@@ -134,7 +136,10 @@ - (void)testMessageWithPastStartAndFutureEndTime {
134136
XCTAssertTrue([FIRMessagingContextManagerService handleContextManagerMessage:message]);
135137

136138
XCTAssertEqual(self.scheduledLocalNotifications.count, 1);
139+
#pragma clang diagnostic push
140+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
137141
UILocalNotification *notification = [self.scheduledLocalNotifications firstObject];
142+
#pragma clang diagnostic pop
138143
// schedule notification after start date
139144
XCTAssertEqual([notification.fireDate compare:startDate], NSOrderedDescending);
140145
// schedule notification after end date
@@ -163,7 +168,10 @@ - (void)testTimedNotificationsUserInfo {
163168
XCTAssertTrue([FIRMessagingContextManagerService handleContextManagerMessage:message]);
164169

165170
XCTAssertEqual(self.scheduledLocalNotifications.count, 1);
171+
#pragma clang diagnostic push
172+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
166173
UILocalNotification *notification = [self.scheduledLocalNotifications firstObject];
174+
#pragma clang diagnostic pop
167175
XCTAssertEqualObjects(notification.userInfo[messageIdentifierKey], messageIdentifier);
168176
XCTAssertEqualObjects(notification.userInfo[customDataKey], customData);
169177
#endif
@@ -175,6 +183,8 @@ - (void)testTimedNotificationsUserInfo {
175183
- (void)mockSchedulingLocalNotifications {
176184
#if TARGET_OS_IOS
177185
id mockApplication = OCMPartialMock([UIApplication sharedApplication]);
186+
#pragma clang diagnostic push
187+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
178188
__block UILocalNotification *notificationToSchedule;
179189
[[[mockApplication stub]
180190
andDo:^(NSInvocation *invocation) {
@@ -189,6 +199,7 @@ - (void)mockSchedulingLocalNotifications {
189199
}
190200
return NO;
191201
}]];
202+
#pragma clang diagnostic pop
192203
#endif
193204
}
194205

Firebase/Messaging/FIRMessaging.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,7 @@ - (void)receiver:(FIRMessagingReceiver *)receiver
874874
#pragma clang diagnostic push
875875
#pragma clang diagnostic ignored "-Wunguarded-availability"
876876
[self.delegate messaging:self didReceiveMessage:remoteMessage];
877-
#pragma pop
877+
#pragma clang diagnostic pop
878878
} else {
879879
// Delegate methods weren't implemented, so messages are being dropped, log a warning
880880
FIRMessagingLoggerWarn(kFIRMessagingMessageCodeRemoteMessageDelegateMethodNotImplemented,

Firebase/Messaging/FIRMessagingContextManagerService.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ + (void)scheduleLocalNotificationForMessage:(NSDictionary *)message
149149
#pragma clang diagnostic push
150150
#pragma clang diagnostic ignored "-Wunguarded-availability"
151151
notification.alertTitle = apsDictionary[kFIRMessagingContextManagerTitleKey];
152-
#pragma pop
152+
#pragma clang diagnostic pop
153153
}
154154
}
155155

@@ -175,7 +175,10 @@ + (void)scheduleLocalNotificationForMessage:(NSDictionary *)message
175175
if (!application) {
176176
return;
177177
}
178+
#pragma clang diagnostic push
179+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
178180
[application scheduleLocalNotification:notification];
181+
#pragma clang diagnostic pop
179182
#endif
180183
}
181184

Firebase/Messaging/FIRMessagingRmq2PersistentStore.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
#pragma clang diagnostic push
107107
#pragma clang diagnostic ignored "-Wunguarded-availability"
108108
const char *errorStr = sqlite3_errstr(result);
109-
#pragma pop
109+
#pragma clang diagnostic pop
110110
NSString *errorString = [NSString stringWithFormat:@"%d - %s", result, errorStr];
111111
return errorString;
112112
}

0 commit comments

Comments
 (0)