Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(apple): fix build issues discovered internally #1178

Merged
merged 5 commits into from
Feb 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/modern-bugs-battle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@react-native-async-storage/async-storage": patch
---

Mark some methods as nonnull
5 changes: 5 additions & 0 deletions packages/default-storage/ios/RNCAsyncStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
*
* Keys and values must always be strings or an error is returned.
*/

NS_ASSUME_NONNULL_BEGIN

@interface RNCAsyncStorage : NSObject <
#ifdef RCT_NEW_ARCH_ENABLED
NativeAsyncStorageModuleSpec
Expand Down Expand Up @@ -60,3 +63,5 @@
- (void)getAllKeys:(RCTResponseSenderBlock)callback;

@end

NS_ASSUME_NONNULL_END
14 changes: 7 additions & 7 deletions packages/default-storage/ios/RNCAsyncStorage.mm
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ static void RCTStorageDirectoryMigrate(NSString *oldDirectoryPath,
// this folder and attempt folder copying again
if (error != nil && error.code == 4 &&
[newDirectoryPath isEqualToString:RCTGetStorageDirectory()]) {
NSError *error = nil;
error = nil;
_createStorageDirectory(RCTCreateStorageDirectoryPath(@""), &error);
if (error == nil) {
RCTStorageDirectoryMigrate(
Expand Down Expand Up @@ -559,7 +559,7 @@ - (NSDictionary *)_ensureSetup
return nil;
}

- (NSDictionary *)_writeManifest:(NSMutableArray<NSDictionary *> **)errors
- (NSDictionary *)_writeManifest:(NSMutableArray<NSDictionary *> *__autoreleasing *)errors
{
NSError *error;
NSString *serialized = RCTJSONStringify(_manifest, &error);
Expand Down Expand Up @@ -587,7 +587,7 @@ - (NSDictionary *)_appendItemForKey:(NSString *)key
return errorOut;
}

- (NSString *)_getValueForKey:(NSString *)key errorOut:(NSDictionary **)errorOut
- (NSString *)_getValueForKey:(NSString *)key errorOut:(NSDictionary *__autoreleasing *)errorOut
{
NSString *value =
_manifest[key]; // nil means missing, null means there may be a data file, else: NSString
Expand Down Expand Up @@ -699,14 +699,14 @@ - (BOOL)_passthroughDelegate
}
}

NSDictionary *errorOut = [self _ensureSetup];
if (errorOut) {
callback(@[@[errorOut], (id)kCFNull]);
NSDictionary *ensureSetupErrorOut = [self _ensureSetup];
if (ensureSetupErrorOut) {
callback(@[@[ensureSetupErrorOut], (id)kCFNull]);
return;
}
[self _multiGet:keys
callback:callback
getter:^(NSUInteger i, NSString *key, NSDictionary **errorOut) {
getter:^(__unused NSUInteger i, NSString *key, NSDictionary **errorOut) {
return [self _getValueForKey:key errorOut:errorOut];
}];
}
Expand Down