diff --git a/CHANGELOG.md b/CHANGELOG.md index 4effe7f9..921e9fbd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file. ### [Version 5.2.2](https://github.com/CleverTap/clevertap-ios-sdk/releases/tag/5.2.2) (November 21, 2023) #### Fixed +- Fixes build warnings. - Mitigates a potential crash when apps would go to the background. ### [Version 5.2.1](https://github.com/CleverTap/clevertap-ios-sdk/releases/tag/5.2.1) (September 29, 2023) diff --git a/CleverTapSDK/CTDeviceInfo.m b/CleverTapSDK/CTDeviceInfo.m index 3472ddc6..59993898 100644 --- a/CleverTapSDK/CTDeviceInfo.m +++ b/CleverTapSDK/CTDeviceInfo.m @@ -428,7 +428,10 @@ - (NSString *)carrier { // CTCarrier is deprecated above iOS version 16 with no replacements so carrierName will be empty. _carrier = @""; } else { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" _carrier = [self getCarrier].carrierName ?: @""; +#pragma clang diagnostic pop } } return _carrier; @@ -441,7 +444,10 @@ - (NSString *)countryCode { NSLocale *currentLocale = [NSLocale currentLocale]; _countryCode = [currentLocale objectForKey:NSLocaleCountryCode]; } else { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" _countryCode = [self getCarrier].isoCountryCode ?: @""; +#pragma clang diagnostic pop } } return _countryCode; @@ -455,14 +461,18 @@ - (NSString *)radio { return _radio; } +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" - (CTCarrier *)getCarrier { if (@available(iOS 12.0, *)) { NSString *providerKey = _networkInfo.serviceSubscriberCellularProviders.allKeys.lastObject; return _networkInfo.serviceSubscriberCellularProviders[providerKey]; } else { + return _networkInfo.subscriberCellularProvider; } } +#pragma clang diagnostic pop - (NSString *)getCurrentRadioAccessTechnology { __block NSString *radioValue; @@ -474,7 +484,10 @@ - (NSString *)getCurrentRadioAccessTechnology { } }]; } else { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" NSString *radio = _networkInfo.currentRadioAccessTechnology; +#pragma clang diagnostic pop if (radio && [radio hasPrefix:@"CTRadioAccessTechnology"]) { radioValue = [radio substringFromIndex:23]; } diff --git a/CleverTapSDK/CTPreferences.m b/CleverTapSDK/CTPreferences.m index 2a6a10a1..4a5c106d 100644 --- a/CleverTapSDK/CTPreferences.m +++ b/CleverTapSDK/CTPreferences.m @@ -107,7 +107,10 @@ + (id _Nullable)unarchiveFromFile:(NSString *_Nonnull)filename ofTypes:(nonnull CleverTapLogStaticInternal(@"%@ unarchived data from %@: %@", self, filePath, data); } } else { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" data = [NSKeyedUnarchiver unarchiveObjectWithFile:filePath]; +#pragma clang diagnostic pop CleverTapLogStaticInternal(@"%@ unarchived data from %@: %@", self, filePath, data); } } @@ -137,7 +140,10 @@ + (id _Nullable)unarchiveFromFile:(NSString *_Nonnull)filename ofType:(Class _No CleverTapLogStaticInternal(@"%@ unarchived data from %@: %@", self, filePath, data); } } else { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" data = [NSKeyedUnarchiver unarchiveObjectWithFile:filePath]; +#pragma clang diagnostic pop CleverTapLogStaticInternal(@"%@ unarchived data from %@: %@", self, filePath, data); } } @@ -170,7 +176,10 @@ + (BOOL)archiveObject:(id)object forFileName:(NSString *)filename config: (Cleve CleverTapLogStaticInternal(@"%@ failed to write data at %@: %@", self, filePath, writeError); } } else { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" success = [NSKeyedArchiver archiveRootObject:object toFile:filePath]; +#pragma clang diagnostic pop if (!success) { CleverTapLogStaticInternal(@"%@ failed to archive data to %@: %@", self, filePath, object); } diff --git a/CleverTapSDK/CTUIUtils.m b/CleverTapSDK/CTUIUtils.m index 1c9779bb..1c255bd8 100644 --- a/CleverTapSDK/CTUIUtils.m +++ b/CleverTapSDK/CTUIUtils.m @@ -76,7 +76,10 @@ + (BOOL)isDeviceOrientationLandscape { } else if (@available(iOS 13.0, *)) { orientation = [CTUIUtils getSharedApplication].windows.firstObject.windowScene.interfaceOrientation; } else { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" orientation = [[CTUIUtils getSharedApplication] statusBarOrientation]; +#pragma clang diagnostic pop } BOOL landscape = UIInterfaceOrientationIsLandscape(orientation); return landscape; diff --git a/CleverTapSDK/CleverTap+FeatureFlags.h b/CleverTapSDK/CleverTap+FeatureFlags.h index cf25a192..b793e3ac 100644 --- a/CleverTapSDK/CleverTap+FeatureFlags.h +++ b/CleverTapSDK/CleverTap+FeatureFlags.h @@ -10,7 +10,7 @@ __attribute__((deprecated("This protocol method has been deprecated and will be @interface CleverTap (FeatureFlags) @property (atomic, strong, readonly, nonnull) CleverTapFeatureFlags *featureFlags -__attribute__((deprecated("This property has been deprecated and will be removed in the future versions of this SDK.")));; +__attribute__((deprecated("This property has been deprecated and will be removed in the future versions of this SDK."))); @end @interface CleverTapFeatureFlags : NSObject diff --git a/CleverTapSDK/CleverTap+ProductConfig.h b/CleverTapSDK/CleverTap+ProductConfig.h index b60e476b..8ab58229 100644 --- a/CleverTapSDK/CleverTap+ProductConfig.h +++ b/CleverTapSDK/CleverTap+ProductConfig.h @@ -13,7 +13,8 @@ __attribute__((deprecated("This protocol method has been deprecated and will be @end @interface CleverTap(ProductConfig) -@property (atomic, strong, readonly, nonnull) CleverTapProductConfig *productConfig; +@property (atomic, strong, readonly, nonnull) CleverTapProductConfig *productConfig +__attribute__((deprecated("This property has been deprecated and will be removed in the future versions of this SDK."))); @end diff --git a/CleverTapSDK/CleverTap.m b/CleverTapSDK/CleverTap.m index 18cae74d..57ffd1db 100644 --- a/CleverTapSDK/CleverTap.m +++ b/CleverTapSDK/CleverTap.m @@ -1687,9 +1687,14 @@ - (NSDictionary *)getNotificationDictionary:(id)object { } else if ([object isKindOfClass:[NSDictionary class]]) { notification = object; } - } else if ([object isKindOfClass:[UILocalNotification class]]) { + } +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + else if ([object isKindOfClass:[UILocalNotification class]]) { notification = [((UILocalNotification *) object) userInfo]; - } else if ([object isKindOfClass:[NSDictionary class]]) { + } +#pragma clang diagnostic pop + else if ([object isKindOfClass:[NSDictionary class]]) { notification = object; } return notification; @@ -4702,6 +4707,8 @@ - (void)_resetFeatureFlags { } } +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" - (void)setFeatureFlagsDelegate:(id)delegate { if (delegate && [delegate conformsToProtocol:@protocol(CleverTapFeatureFlagsDelegate)]) { _featureFlagsDelegate = delegate; @@ -4719,6 +4726,7 @@ - (void)featureFlagsDidUpdate { [self.featureFlagsDelegate ctFeatureFlagsUpdated]; } } +#pragma clang diagnostic pop - (void)fetchFeatureFlags { [self queueEvent:@{@"evtName": CLTAP_WZRK_FETCH_EVENT, @"evtData" : @{@"t": @1}} withType:CleverTapEventTypeFetch]; @@ -4778,6 +4786,8 @@ - (NSDictionary *)_setProductConfig:(NSDictionary *)arp { return nil; } +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" - (void)setProductConfigDelegate:(id)delegate { if (delegate && [delegate conformsToProtocol:@protocol(CleverTapProductConfigDelegate)]) { _productConfigDelegate = delegate; @@ -4807,6 +4817,7 @@ - (void)productConfigDidInitialize { [self.productConfigDelegate ctProductConfigInitialized]; } } +#pragma clang diagnostic pop - (void)fetchProductConfig { [self queueEvent:@{@"evtName": CLTAP_WZRK_FETCH_EVENT, @"evtData" : @{@"t": @0}} withType:CleverTapEventTypeFetch]; diff --git a/CleverTapSDK/FeatureFlags/controllers/CTFeatureFlagsController.m b/CleverTapSDK/FeatureFlags/controllers/CTFeatureFlagsController.m index ea81af60..828d4e61 100644 --- a/CleverTapSDK/FeatureFlags/controllers/CTFeatureFlagsController.m +++ b/CleverTapSDK/FeatureFlags/controllers/CTFeatureFlagsController.m @@ -107,7 +107,7 @@ - (void)_unarchiveDataSync:(BOOL)sync { - (void)_archiveData:(NSArray*)data sync:(BOOL)sync { NSString *filePath = [self dataArchiveFileName]; CTFeatureFlagsOperationBlock opBlock = ^{ - [CTPreferences archiveObject:data forFileName:filePath config:_config]; + [CTPreferences archiveObject:data forFileName:filePath config:self->_config]; }; if (sync) { opBlock(); diff --git a/CleverTapSDK/FeatureFlags/models/CleverTapFeatureFlagsPrivate.h b/CleverTapSDK/FeatureFlags/models/CleverTapFeatureFlagsPrivate.h index 924962b4..98a63a4f 100644 --- a/CleverTapSDK/FeatureFlags/models/CleverTapFeatureFlagsPrivate.h +++ b/CleverTapSDK/FeatureFlags/models/CleverTapFeatureFlagsPrivate.h @@ -4,7 +4,10 @@ @protocol CleverTapPrivateFeatureFlagsDelegate @required +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" @property (atomic, weak) id _Nullable featureFlagsDelegate; +#pragma clang diagnostic pop - (BOOL)getFeatureFlag:(NSString* _Nonnull)key withDefaultValue:(BOOL)defaultValue; diff --git a/CleverTapSDK/InApps/CTCoverImageViewController.m b/CleverTapSDK/InApps/CTCoverImageViewController.m index 69520fc1..161e8d40 100644 --- a/CleverTapSDK/InApps/CTCoverImageViewController.m +++ b/CleverTapSDK/InApps/CTCoverImageViewController.m @@ -32,7 +32,10 @@ - (void)viewDidLayoutSubviews { if (@available(iOS 11.0, *)) { topLength = self.view.safeAreaInsets.top; } else { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" topLength = self.topLayoutGuide.length; +#pragma clang diagnostic pop } [[NSLayoutConstraint constraintWithItem: self.closeButton attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationGreaterThanOrEqual diff --git a/CleverTapSDK/InApps/CTCoverViewController.m b/CleverTapSDK/InApps/CTCoverViewController.m index 4a81d93b..a71316cf 100644 --- a/CleverTapSDK/InApps/CTCoverViewController.m +++ b/CleverTapSDK/InApps/CTCoverViewController.m @@ -42,7 +42,10 @@ - (void)viewDidLayoutSubviews { if (@available(iOS 11.0, *)) { topLength = self.view.safeAreaInsets.top; } else { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" topLength = self.topLayoutGuide.length; +#pragma clang diagnostic pop } [[NSLayoutConstraint constraintWithItem: self.closeButton attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationGreaterThanOrEqual diff --git a/CleverTapSDK/InApps/CTHeaderViewController.m b/CleverTapSDK/InApps/CTHeaderViewController.m index 471a0381..27e37d4d 100644 --- a/CleverTapSDK/InApps/CTHeaderViewController.m +++ b/CleverTapSDK/InApps/CTHeaderViewController.m @@ -29,7 +29,10 @@ - (void)viewDidLayoutSubviews { if (@available(iOS 11.0, *)) { topLength = self.view.safeAreaInsets.top; } else { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" topLength = self.topLayoutGuide.length; +#pragma clang diagnostic pop } [[NSLayoutConstraint constraintWithItem: self.containerView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationGreaterThanOrEqual diff --git a/CleverTapSDK/InApps/CTInAppHTMLViewController.m b/CleverTapSDK/InApps/CTInAppHTMLViewController.m index ce64ec3f..262b90de 100644 --- a/CleverTapSDK/InApps/CTInAppHTMLViewController.m +++ b/CleverTapSDK/InApps/CTInAppHTMLViewController.m @@ -152,7 +152,10 @@ - (void)loadWebView { if (@available(iOS 13.0, *)) { statusBarFrameHeight = [[CTUIUtils getKeyWindow] windowScene].statusBarManager.statusBarFrame.size.height; } else { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" statusBarFrameHeight = [[CTUIUtils getSharedApplication] statusBarFrame].size.height; +#pragma clang diagnostic pop } CGFloat statusBarHeight = self.notification.heightPercent == 100.0 ? statusBarFrameHeight : 0.0; diff --git a/CleverTapSDK/Inbox/controllers/CleverTapInboxViewController.m b/CleverTapSDK/Inbox/controllers/CleverTapInboxViewController.m index b404d89c..6472b095 100755 --- a/CleverTapSDK/Inbox/controllers/CleverTapInboxViewController.m +++ b/CleverTapSDK/Inbox/controllers/CleverTapInboxViewController.m @@ -171,7 +171,14 @@ - (void)setUpTableViewLayout { self.tableView.estimatedRowHeight = 44.0; self.tableView.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, self.tableView.bounds.size.width, kCellSpacing)]; self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, self.tableView.bounds.size.width, 1.0)]; - self.automaticallyAdjustsScrollViewInsets = NO; + if (@available(iOS 11.0, *)) { + self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; + } else { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + self.automaticallyAdjustsScrollViewInsets = NO; +#pragma clang diagnostic pop + } self.edgesForExtendedLayout = UIRectEdgeNone; self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; } diff --git a/CleverTapSDK/Inbox/views/UIView+CTToast.m b/CleverTapSDK/Inbox/views/UIView+CTToast.m index 5f755bf3..24b58701 100755 --- a/CleverTapSDK/Inbox/views/UIView+CTToast.m +++ b/CleverTapSDK/Inbox/views/UIView+CTToast.m @@ -398,7 +398,10 @@ - (void)ct_makeToastActivity:(id)position { if (@available(iOS 13.0, *)) { activityIndicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleLarge]; } else { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" activityIndicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; +#pragma clang diagnostic pop } activityIndicatorView.center = CGPointMake(activityView.bounds.size.width / 2, activityView.bounds.size.height / 2); [activityView addSubview:activityIndicatorView]; diff --git a/CleverTapSDK/ProductConfig/controllers/CTProductConfigController.m b/CleverTapSDK/ProductConfig/controllers/CTProductConfigController.m index eda02e41..7cc4c020 100644 --- a/CleverTapSDK/ProductConfig/controllers/CTProductConfigController.m +++ b/CleverTapSDK/ProductConfig/controllers/CTProductConfigController.m @@ -188,7 +188,7 @@ - (void)_unarchiveDataSync:(BOOL)sync { - (void)_archiveData:(NSArray*)data sync:(BOOL)sync { NSString *filePath = [self dataArchiveFileName]; CTProductConfigOperationBlock opBlock = ^{ - [CTPreferences archiveObject:data forFileName:filePath config:_config]; + [CTPreferences archiveObject:data forFileName:filePath config:self->_config]; }; if (sync) { opBlock(); diff --git a/CleverTapSDK/ProductConfig/models/CleverTapProductConfigPrivate.h b/CleverTapSDK/ProductConfig/models/CleverTapProductConfigPrivate.h index 59312f2b..277856ac 100644 --- a/CleverTapSDK/ProductConfig/models/CleverTapProductConfigPrivate.h +++ b/CleverTapSDK/ProductConfig/models/CleverTapProductConfigPrivate.h @@ -4,7 +4,10 @@ @protocol CleverTapPrivateProductConfigDelegate @required +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" @property (atomic, weak) id _Nullable productConfigDelegate; +#pragma clang diagnostic pop - (void)fetchProductConfig;