Skip to content

Commit 5042047

Browse files
authoredFeb 2, 2025··
fix(apple): fix build issues discovered by stricter build flags (#1178)

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed
 

‎.changeset/modern-bugs-battle.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@react-native-async-storage/async-storage": patch
3+
---
4+
5+
Mark some methods as nonnull

‎packages/default-storage/ios/RNCAsyncStorage.h

+5
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
*
2828
* Keys and values must always be strings or an error is returned.
2929
*/
30+
31+
NS_ASSUME_NONNULL_BEGIN
32+
3033
@interface RNCAsyncStorage : NSObject <
3134
#ifdef RCT_NEW_ARCH_ENABLED
3235
NativeAsyncStorageModuleSpec
@@ -60,3 +63,5 @@
6063
- (void)getAllKeys:(RCTResponseSenderBlock)callback;
6164

6265
@end
66+
67+
NS_ASSUME_NONNULL_END

‎packages/default-storage/ios/RNCAsyncStorage.mm

+7-7
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ static void RCTStorageDirectoryMigrate(NSString *oldDirectoryPath,
302302
// this folder and attempt folder copying again
303303
if (error != nil && error.code == 4 &&
304304
[newDirectoryPath isEqualToString:RCTGetStorageDirectory()]) {
305-
NSError *error = nil;
305+
error = nil;
306306
_createStorageDirectory(RCTCreateStorageDirectoryPath(@""), &error);
307307
if (error == nil) {
308308
RCTStorageDirectoryMigrate(
@@ -559,7 +559,7 @@ - (NSDictionary *)_ensureSetup
559559
return nil;
560560
}
561561

562-
- (NSDictionary *)_writeManifest:(NSMutableArray<NSDictionary *> **)errors
562+
- (NSDictionary *)_writeManifest:(NSMutableArray<NSDictionary *> *__autoreleasing *)errors
563563
{
564564
NSError *error;
565565
NSString *serialized = RCTJSONStringify(_manifest, &error);
@@ -587,7 +587,7 @@ - (NSDictionary *)_appendItemForKey:(NSString *)key
587587
return errorOut;
588588
}
589589

590-
- (NSString *)_getValueForKey:(NSString *)key errorOut:(NSDictionary **)errorOut
590+
- (NSString *)_getValueForKey:(NSString *)key errorOut:(NSDictionary *__autoreleasing *)errorOut
591591
{
592592
NSString *value =
593593
_manifest[key]; // nil means missing, null means there may be a data file, else: NSString
@@ -699,14 +699,14 @@ - (BOOL)_passthroughDelegate
699699
}
700700
}
701701

702-
NSDictionary *errorOut = [self _ensureSetup];
703-
if (errorOut) {
704-
callback(@[@[errorOut], (id)kCFNull]);
702+
NSDictionary *ensureSetupErrorOut = [self _ensureSetup];
703+
if (ensureSetupErrorOut) {
704+
callback(@[@[ensureSetupErrorOut], (id)kCFNull]);
705705
return;
706706
}
707707
[self _multiGet:keys
708708
callback:callback
709-
getter:^(NSUInteger i, NSString *key, NSDictionary **errorOut) {
709+
getter:^(__unused NSUInteger i, NSString *key, NSDictionary **errorOut) {
710710
return [self _getValueForKey:key errorOut:errorOut];
711711
}];
712712
}

0 commit comments

Comments
 (0)
Please sign in to comment.