Skip to content

Commit 3936520

Browse files
pan-applepull[bot]
authored andcommitted
Fix persistent storage delegate in iOS framework (#3859)
1 parent 5402d51 commit 3936520

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/darwin/Framework/CHIP/CHIPPersistentStorageDelegateBridge.mm

+5-5
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@
8181

8282
void CHIPPersistentStorageDelegateBridge::GetKeyValue(const char * key)
8383
{
84+
NSString * keyString = [NSString stringWithUTF8String:key];
8485
dispatch_async(mWorkQueue, ^{
85-
NSString * keyString = [NSString stringWithUTF8String:key];
8686
NSLog(@"PersistentStorageDelegate Get Value for Key: %@", keyString);
8787

8888
id<CHIPPersistentStorageDelegate> strongDelegate = mDelegate;
@@ -101,8 +101,8 @@
101101
CHIP_ERROR CHIPPersistentStorageDelegateBridge::GetKeyValue(const char * key, char * value, uint16_t & size)
102102
{
103103
__block CHIP_ERROR error = CHIP_NO_ERROR;
104+
NSString * keyString = [NSString stringWithUTF8String:key];
104105
dispatch_sync(mWorkQueue, ^{
105-
NSString * keyString = [NSString stringWithUTF8String:key];
106106
NSLog(@"PersistentStorageDelegate Sync Get Value for Key: %@", keyString);
107107

108108
NSString * valueString = nil;
@@ -131,9 +131,9 @@
131131

132132
void CHIPPersistentStorageDelegateBridge::SetKeyValue(const char * key, const char * value)
133133
{
134+
NSString * keyString = [NSString stringWithUTF8String:key];
135+
NSString * valueString = [NSString stringWithUTF8String:value];
134136
dispatch_async(mWorkQueue, ^{
135-
NSString * keyString = [NSString stringWithUTF8String:key];
136-
NSString * valueString = [NSString stringWithUTF8String:value];
137137
NSLog(@"PersistentStorageDelegate Set Key %@, Value %@", keyString, valueString);
138138

139139
id<CHIPPersistentStorageDelegate> strongDelegate = mDelegate;
@@ -150,8 +150,8 @@
150150

151151
void CHIPPersistentStorageDelegateBridge::DeleteKeyValue(const char * key)
152152
{
153+
NSString * keyString = [NSString stringWithUTF8String:key];
153154
dispatch_async(mWorkQueue, ^{
154-
NSString * keyString = [NSString stringWithUTF8String:key];
155155
NSLog(@"PersistentStorageDelegate Delete Key: %@", keyString);
156156

157157
id<CHIPPersistentStorageDelegate> strongDelegate = mDelegate;

0 commit comments

Comments
 (0)