Remove suppression of the unguarded-availability warning.

It's not clear why the availability check doesn't work,
but the plain old macro works just fine, so we can get rid of
the suppression of another compiler warning.

Fixed: webrtc:10837
Change-Id: I4f5bcba794a0e34103e581c3e6495c9542e07342
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/228701
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
Commit-Queue: Kári Helgason <kthelgason@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34819}
diff --git a/examples/BUILD.gn b/examples/BUILD.gn
index dbe383f..0a7eabd 100644
--- a/examples/BUILD.gn
+++ b/examples/BUILD.gn
@@ -239,11 +239,6 @@
 
   config("apprtc_signaling_config") {
     include_dirs = [ "objc/AppRTCMobile" ]
-    cflags_objc = [
-      # TODO(bugs.webrtc.org/10837): Remove this when usage of
-      # archivedDataWithRootObject will be removed.
-      "-Wno-unguarded-availability",
-    ]
   }
 
   rtc_library("apprtc_signaling") {
diff --git a/examples/objc/AppRTCMobile/ARDSettingsModel.m b/examples/objc/AppRTCMobile/ARDSettingsModel.m
index c628f0f..9e709b0 100644
--- a/examples/objc/AppRTCMobile/ARDSettingsModel.m
+++ b/examples/objc/AppRTCMobile/ARDSettingsModel.m
@@ -77,6 +77,7 @@
 - (RTC_OBJC_TYPE(RTCVideoCodecInfo) *)currentVideoCodecSettingFromStore {
   [self registerStoreDefaults];
   NSData *codecData = [[self settingsStore] videoCodec];
+#if defined(WEBRTC_IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_13
   Class expectedClass = [RTC_OBJC_TYPE(RTCVideoCodecInfo) class];
   NSError *error;
   RTC_OBJC_TYPE(RTCVideoCodecInfo) *videoCodecSetting =
@@ -85,6 +86,9 @@
     return videoCodecSetting;
   }
   return nil;
+#else
+  return [NSKeyedUnarchiver unarchiveObjectWithData:codecData];
+#endif
 }
 
 - (BOOL)storeVideoCodecSetting:(RTC_OBJC_TYPE(RTCVideoCodecInfo) *)videoCodec {
@@ -92,15 +96,20 @@
     return NO;
   }
 
+#if defined(WEBRTC_IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_13
   NSError *error;
   NSData *codecData = [NSKeyedArchiver archivedDataWithRootObject:videoCodec
                                             requiringSecureCoding:NO
                                                             error:&error];
-  if (!error) {
-    [[self settingsStore] setVideoCodec:codecData];
-    return YES;
+  if (error) {
+    return NO;
   }
-  return NO;
+#else
+  NSData *codecData = [NSKeyedArchiver archivedDataWithRootObject:videoCodec];
+#endif
+
+  [[self settingsStore] setVideoCodec:codecData];
+  return YES;
 }
 
 - (nullable NSNumber *)currentMaxBitrateSettingFromStore {
@@ -179,18 +188,24 @@
 }
 
 - (void)registerStoreDefaults {
+#if defined(WEBRTC_IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_13
   NSError *error;
   NSData *codecData = [NSKeyedArchiver archivedDataWithRootObject:[self defaultVideoCodecSetting]
                                             requiringSecureCoding:NO
                                                             error:&error];
-  if (!error) {
-    [ARDSettingsStore setDefaultsForVideoResolution:[self defaultVideoResolutionSetting]
-                                         videoCodec:codecData
-                                            bitrate:nil
-                                          audioOnly:NO
-                                      createAecDump:NO
-                               useManualAudioConfig:YES];
+  if (error) {
+    return;
   }
+#else
+  NSData *codecData = [NSKeyedArchiver archivedDataWithRootObject:[self defaultVideoCodecSetting]];
+#endif
+
+  [ARDSettingsStore setDefaultsForVideoResolution:[self defaultVideoResolutionSetting]
+                                       videoCodec:codecData
+                                          bitrate:nil
+                                        audioOnly:NO
+                                    createAecDump:NO
+                             useManualAudioConfig:YES];
 }
 @end
 NS_ASSUME_NONNULL_END