Skip to content

Commit 6465dbd

Browse files
Fixed all warnings and changed the base version to 12 (#121)
* Fixed all warnings and changed base version to 12 * Cartfile change reverted to original --------- Co-authored-by: SujishaExalture <[email protected]>
1 parent 780024c commit 6465dbd

File tree

10 files changed

+64
-120
lines changed

10 files changed

+64
-120
lines changed

HelloSift/Cartfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
github "SiftScience/sift-ios" ~> 2.1.1
1+
github "SiftScience/sift-ios" ~> 2.1.1

Sift.xcodeproj/project.pbxproj

+4-4
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@
424424
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
425425
GCC_WARN_UNUSED_FUNCTION = YES;
426426
GCC_WARN_UNUSED_VARIABLE = YES;
427-
IPHONEOS_DEPLOYMENT_TARGET = 9.2;
427+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
428428
MTL_ENABLE_DEBUG_INFO = YES;
429429
ONLY_ACTIVE_ARCH = YES;
430430
SDKROOT = iphoneos;
@@ -477,7 +477,7 @@
477477
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
478478
GCC_WARN_UNUSED_FUNCTION = YES;
479479
GCC_WARN_UNUSED_VARIABLE = YES;
480-
IPHONEOS_DEPLOYMENT_TARGET = 9.2;
480+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
481481
MTL_ENABLE_DEBUG_INFO = NO;
482482
SDKROOT = iphoneos;
483483
TARGETED_DEVICE_FAMILY = "1,2";
@@ -498,7 +498,7 @@
498498
"GCC_PREPROCESSOR_DEFINITIONS[arch=*]" = "DEBUG=1";
499499
INFOPLIST_FILE = Sift/Info.plist;
500500
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
501-
IPHONEOS_DEPLOYMENT_TARGET = 9.2;
501+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
502502
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
503503
PRODUCT_BUNDLE_IDENTIFIER = com.sift.Sift;
504504
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -518,7 +518,7 @@
518518
DYLIB_INSTALL_NAME_BASE = "@rpath";
519519
INFOPLIST_FILE = Sift/Info.plist;
520520
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
521-
IPHONEOS_DEPLOYMENT_TARGET = 9.2;
521+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
522522
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
523523
PRODUCT_BUNDLE_IDENTIFIER = com.sift.Sift;
524524
PRODUCT_NAME = "$(TARGET_NAME)";
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>

Sift/NSData+GZIP.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
@implementation NSData (GZIP)
4343

44-
static void *libzOpen()
44+
static void *libzOpen(void)
4545
{
4646
static void *libz;
4747
static dispatch_once_t onceToken;

Sift/Sift.m

+12-32
Original file line numberDiff line numberDiff line change
@@ -294,44 +294,24 @@ - (void)archiveKeys {
294294
[archive setObject:_userId forKey:SF_SIFT_USER_ID];
295295
}
296296
NSError *error;
297-
#if TARGET_OS_MACCATALYST
298-
if ([self archivePathForKeys] != nil) {
299-
NSData* data = [NSKeyedArchiver archivedDataWithRootObject: archive requiringSecureCoding:NO error:&error];
300-
[data writeToFile:[self archivePathForKeys] options:NSDataWritingAtomic error:&error];
301-
SF_DEBUG(@"Write returned error: %@", [error localizedDescription]);
302-
}
303-
#else
304-
if (@available(iOS 11.0, *)) {
305-
if ([self archivePathForKeys] != nil) {
306-
NSData* data = [NSKeyedArchiver archivedDataWithRootObject: archive requiringSecureCoding:NO error:&error];
307-
[data writeToFile:[self archivePathForKeys] options:NSDataWritingAtomic error:&error];
308-
SF_DEBUG(@"Write returned error: %@", [error localizedDescription]);
309-
}
310-
} else {
311-
[NSKeyedArchiver archiveRootObject:archive toFile:[self archivePathForKeys]];
312-
}
313-
#endif
297+
298+
if ([self archivePathForKeys] != nil) {
299+
NSData* data = [NSKeyedArchiver archivedDataWithRootObject: archive requiringSecureCoding:NO error:&error];
300+
[data writeToFile:[self archivePathForKeys] options:NSDataWritingAtomic error:&error];
301+
SF_DEBUG(@"Write returned error: %@", [error localizedDescription]);
302+
}
303+
314304
}
315305

316306
- (void)unarchiveKeys {
317307
NSDictionary *archive;
318308
NSData *newData = [NSData dataWithContentsOfFile:[self archivePathForKeys]];
319309
NSError *error;
320-
#if TARGET_OS_MACCATALYST
321-
NSKeyedUnarchiver* unarchiver = [[NSKeyedUnarchiver alloc] initForReadingFromData:newData error:&error];
322-
unarchiver.requiresSecureCoding = NO;
323-
archive = [unarchiver decodeTopLevelObjectForKey:NSKeyedArchiveRootObjectKey error:&error];
324-
SF_DEBUG(@"error unarchiving data: %@", error.localizedDescription);
325-
#else
326-
if (@available(iOS 11.0, *)) {
327-
NSKeyedUnarchiver* unarchiver = [[NSKeyedUnarchiver alloc] initForReadingFromData:newData error:&error];
328-
unarchiver.requiresSecureCoding = NO;
329-
archive = [unarchiver decodeTopLevelObjectForKey:NSKeyedArchiveRootObjectKey error:&error];
330-
SF_DEBUG(@"error unarchiving data: %@", error.localizedDescription);
331-
} else {
332-
archive = [NSKeyedUnarchiver unarchiveObjectWithFile:[self archivePathForKeys]];
333-
}
334-
#endif
310+
311+
NSKeyedUnarchiver* unarchiver = [[NSKeyedUnarchiver alloc] initForReadingFromData:newData error:&error];
312+
unarchiver.requiresSecureCoding = NO;
313+
archive = [unarchiver decodeTopLevelObjectForKey:NSKeyedArchiveRootObjectKey error:&error];
314+
SF_DEBUG(@"error unarchiving data: %@", error.localizedDescription);
335315

336316
if (archive) {
337317
_accountId = [archive objectForKey:SF_SIFT_ACCOUNT_ID];

Sift/SiftIosAppState.m

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
#import "Sift.h"
1616
#import "SiftIosAppState.h"
1717

18-
NSMutableDictionary *SFMakeEmptyIosAppState() {
18+
NSMutableDictionary *SFMakeEmptyIosAppState(void) {
1919
return [NSMutableDictionary new];
2020
}
2121

22-
NSMutableDictionary *SFMakeLocation() {
22+
NSMutableDictionary *SFMakeLocation(void) {
2323
return [NSMutableDictionary new];
2424
}
2525

@@ -84,7 +84,7 @@
8484
return dict;
8585
}
8686

87-
static SF_GENERICS(NSArray, NSString *) *getIpAddresses() {
87+
static SF_GENERICS(NSArray, NSString *) *getIpAddresses(void) {
8888
struct ifaddrs *interfaces;
8989
if (getifaddrs(&interfaces)) {
9090
SF_DEBUG(@"Cannot get network interface: %s", strerror(errno));

Sift/SiftIosAppStateCollector.m

+10-26
Original file line numberDiff line numberDiff line change
@@ -208,17 +208,10 @@ - (void)collectWithTitle:(NSString *)title andTimestamp:(SFTimestamp)now {
208208
- (void)archive {
209209
dispatch_sync(_serial, ^{
210210
NSDictionary *archive = @{SF_BUCKET: _bucket, SF_LAST_COLLECTED_AT: @(_lastCollectedAt)};
211-
#if TARGET_OS_MACCATALYST
212-
NSData* data = [NSKeyedArchiver archivedDataWithRootObject: archive requiringSecureCoding:NO error:nil];
213-
[data writeToFile:self->_archivePath options:NSDataWritingAtomic error:nil];
214-
#else
215-
if (@available(iOS 11.0, *)) {
216-
NSData* data = [NSKeyedArchiver archivedDataWithRootObject: archive requiringSecureCoding:NO error:nil];
217-
[data writeToFile:self->_archivePath options:NSDataWritingAtomic error:nil];
218-
} else {
219-
[NSKeyedArchiver archiveRootObject:archive toFile:self->_archivePath];
220-
}
221-
#endif
211+
212+
NSData* data = [NSKeyedArchiver archivedDataWithRootObject: archive requiringSecureCoding:NO error:nil];
213+
[data writeToFile:self->_archivePath options:NSDataWritingAtomic error:nil];
214+
222215
});
223216
}
224217

@@ -227,21 +220,12 @@ - (void)unarchive {
227220
NSDictionary *archive;
228221
NSData *newData = [NSData dataWithContentsOfFile:_archivePath];
229222
NSError *error;
230-
#if TARGET_OS_MACCATALYST
231-
NSKeyedUnarchiver* unarchiver = [[NSKeyedUnarchiver alloc] initForReadingFromData:newData error:&error];
232-
unarchiver.requiresSecureCoding = NO;
233-
archive = [unarchiver decodeTopLevelObjectForKey:NSKeyedArchiveRootObjectKey error:&error];
234-
SF_DEBUG(@"error unarchiving data: %@", error.localizedDescription);
235-
#else
236-
if (@available(iOS 11.0, *)) {
237-
NSKeyedUnarchiver* unarchiver = [[NSKeyedUnarchiver alloc] initForReadingFromData:newData error:&error];
238-
unarchiver.requiresSecureCoding = NO;
239-
archive = [unarchiver decodeTopLevelObjectForKey:NSKeyedArchiveRootObjectKey error:&error];
240-
SF_DEBUG(@"error unarchiving data: %@", error.localizedDescription);
241-
} else {
242-
archive = [NSKeyedUnarchiver unarchiveObjectWithFile:_archivePath];
243-
}
244-
#endif
223+
224+
NSKeyedUnarchiver* unarchiver = [[NSKeyedUnarchiver alloc] initForReadingFromData:newData error:&error];
225+
unarchiver.requiresSecureCoding = NO;
226+
archive = [unarchiver decodeTopLevelObjectForKey:NSKeyedArchiveRootObjectKey error:&error];
227+
SF_DEBUG(@"error unarchiving data: %@", error.localizedDescription);
228+
245229
if (archive) {
246230
_bucket = archive[SF_BUCKET];
247231
_lastCollectedAt = ((NSNumber *)archive[SF_LAST_COLLECTED_AT]).unsignedLongLongValue;

Sift/SiftIosDeviceProperties.m

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Copyright (c) 2016 Sift Science. All rights reserved.
22

3+
#include <TargetConditionals.h>
34
#if !TARGET_OS_MACCATALYST
45
@import CoreTelephony;
56
#endif
@@ -17,7 +18,7 @@
1718

1819
#import "SiftIosDeviceProperties.h"
1920

20-
NSMutableDictionary *SFMakeEmptyIosDeviceProperties() {
21+
NSMutableDictionary *SFMakeEmptyIosDeviceProperties(void) {
2122
return [NSMutableDictionary new];
2223
}
2324

@@ -31,7 +32,7 @@
3132

3233
static BOOL SFIsUrlSchemeWhitelisted(NSString *targetScheme);
3334

34-
NSMutableDictionary *SFCollectIosDeviceProperties() {
35+
NSMutableDictionary *SFCollectIosDeviceProperties(void) {
3536
NSMutableDictionary *iosDeviceProperties = SFMakeEmptyIosDeviceProperties();
3637

3738
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
@@ -52,7 +53,10 @@
5253

5354
#if !TARGET_OS_MACCATALYST
5455
CTTelephonyNetworkInfo *networkInfo = [CTTelephonyNetworkInfo new];
55-
CTCarrier *carrier = [networkInfo subscriberCellularProvider];
56+
57+
NSDictionary<NSString *, CTCarrier *> *providers= [networkInfo serviceSubscriberCellularProviders];
58+
CTCarrier *carrier = providers.allValues.firstObject;
59+
5660
if (carrier) {
5761
[iosDeviceProperties setValue:carrier.carrierName forKey:@"mobile_carrier_name"];
5862
[iosDeviceProperties setValue:carrier.isoCountryCode forKey:@"mobile_iso_country_code"];

Sift/SiftQueue.m

+10-26
Original file line numberDiff line numberDiff line change
@@ -99,17 +99,10 @@ - (void)archive {
9999
[archive setObject:_lastEvent forKey:SF_LAST_EVENT];
100100
}
101101
[archive setObject:@(_lastUploadTimestamp) forKey:SF_LAST_UPLOAD_TIMESTAMP];
102-
#if TARGET_OS_MACCATALYST
103-
NSData* data = [NSKeyedArchiver archivedDataWithRootObject: archive requiringSecureCoding:NO error:nil];
104-
[data writeToFile:self->_archivePath options:NSDataWritingAtomic error:nil];
105-
#else
106-
if (@available(iOS 11.0, *)) {
107-
NSData* data = [NSKeyedArchiver archivedDataWithRootObject: archive requiringSecureCoding:NO error:nil];
108-
[data writeToFile:self->_archivePath options:NSDataWritingAtomic error:nil];
109-
} else {
110-
[NSKeyedArchiver archiveRootObject:archive toFile:self->_archivePath];
111-
}
112-
#endif
102+
103+
NSData* data = [NSKeyedArchiver archivedDataWithRootObject: archive requiringSecureCoding:NO error:nil];
104+
[data writeToFile:self->_archivePath options:NSDataWritingAtomic error:nil];
105+
113106
}
114107
}
115108

@@ -118,21 +111,12 @@ - (void)unarchive {
118111
NSDictionary *archive;
119112
NSError *error;
120113
NSData *newData = [NSData dataWithContentsOfFile:_archivePath];
121-
#if TARGET_OS_MACCATALYST
122-
NSKeyedUnarchiver* unarchiver = [[NSKeyedUnarchiver alloc] initForReadingFromData:newData error:&error];
123-
unarchiver.requiresSecureCoding = NO;
124-
archive = [unarchiver decodeTopLevelObjectForKey:NSKeyedArchiveRootObjectKey error:&error];
125-
SF_DEBUG(@"error unarchiving data: %@", error.localizedDescription);
126-
#else
127-
if (@available(iOS 11.0, *)) {
128-
NSKeyedUnarchiver* unarchiver = [[NSKeyedUnarchiver alloc] initForReadingFromData:newData error:&error];
129-
unarchiver.requiresSecureCoding = NO;
130-
archive = [unarchiver decodeTopLevelObjectForKey:NSKeyedArchiveRootObjectKey error:&error];
131-
SF_DEBUG(@"error unarchiving data: %@", error.localizedDescription);
132-
} else {
133-
archive = [NSKeyedUnarchiver unarchiveObjectWithFile:_archivePath];
134-
}
135-
#endif
114+
115+
NSKeyedUnarchiver* unarchiver = [[NSKeyedUnarchiver alloc] initForReadingFromData:newData error:&error];
116+
unarchiver.requiresSecureCoding = NO;
117+
archive = [unarchiver decodeTopLevelObjectForKey:NSKeyedArchiveRootObjectKey error:&error];
118+
SF_DEBUG(@"error unarchiving data: %@", error.localizedDescription);
119+
136120
if (archive) {
137121
_queue = [NSMutableArray arrayWithArray:[archive objectForKey:SF_QUEUE]];
138122
_lastEvent = [archive objectForKey:SF_LAST_EVENT];

Sift/SiftUploader.m

+8-24
Original file line numberDiff line numberDiff line change
@@ -207,17 +207,10 @@ - (void)doUpload {
207207
- (void)archive {
208208
[self->_taskManager submitWithTask:^{
209209
NSDictionary *archive = @{SF_BATCHES: self->_batches, SF_NUM_REJECTS: @(self->_numRejects)};
210-
#if TARGET_OS_MACCATALYST
210+
211211
NSData* data = [NSKeyedArchiver archivedDataWithRootObject: archive requiringSecureCoding:NO error:nil];
212212
[data writeToFile:self->_archivePath options:NSDataWritingAtomic error:nil];
213-
#else
214-
if (@available(iOS 11.0, *)) {
215-
NSData* data = [NSKeyedArchiver archivedDataWithRootObject: archive requiringSecureCoding:NO error:nil];
216-
[data writeToFile:self->_archivePath options:NSDataWritingAtomic error:nil];
217-
} else {
218-
[NSKeyedArchiver archiveRootObject:archive toFile:self->_archivePath];
219-
}
220-
#endif
213+
221214
} queue:_serial];
222215
}
223216

@@ -226,21 +219,12 @@ - (void)unarchive {
226219
NSDictionary *archive;
227220
NSData *newData = [NSData dataWithContentsOfFile:_archivePath];
228221
NSError *error;
229-
#if TARGET_OS_MACCATALYST
230-
NSKeyedUnarchiver* unarchiver = [[NSKeyedUnarchiver alloc] initForReadingFromData:newData error:&error];
231-
unarchiver.requiresSecureCoding = NO;
232-
archive = [unarchiver decodeTopLevelObjectForKey:NSKeyedArchiveRootObjectKey error:&error];
233-
SF_DEBUG(@"error unarchiving data: %@", error.localizedDescription);
234-
#else
235-
if (@available(iOS 11.0, *)) {
236-
NSKeyedUnarchiver* unarchiver = [[NSKeyedUnarchiver alloc] initForReadingFromData:newData error:&error];
237-
unarchiver.requiresSecureCoding = NO;
238-
archive = [unarchiver decodeTopLevelObjectForKey:NSKeyedArchiveRootObjectKey error:&error];
239-
SF_DEBUG(@"error unarchiving data: %@", error.localizedDescription);
240-
} else {
241-
archive = [NSKeyedUnarchiver unarchiveObjectWithFile:_archivePath];
242-
}
243-
#endif
222+
223+
NSKeyedUnarchiver* unarchiver = [[NSKeyedUnarchiver alloc] initForReadingFromData:newData error:&error];
224+
unarchiver.requiresSecureCoding = NO;
225+
archive = [unarchiver decodeTopLevelObjectForKey:NSKeyedArchiveRootObjectKey error:&error];
226+
SF_DEBUG(@"error unarchiving data: %@", error.localizedDescription);
227+
244228
if (archive) {
245229
_batches = [NSMutableArray arrayWithArray:[archive objectForKey:SF_BATCHES]];
246230
_numRejects = ((NSNumber *)[archive objectForKey:SF_NUM_REJECTS]).intValue;

0 commit comments

Comments
 (0)