title: Using RCTAsyncLocalStorage + getAllKeys
body: <p>I'm trying to get the AsyncStorage on iOS native code. So this is my code</p>
  
  <pre><code>- (void)jsonFromLocalRNStrogeForKey:(NSString *)key completion:(void (^)(NSDictionary * _Nullable, NSError * _Nullable))completion {
      RCTResponseSenderBlock rnCompletion = ^(NSArray *response) {
  
          NSString *jsonAsString;
  
          if (response.count &gt; 1) {
              NSArray *response1 = response[1];
              if (response1.count &gt; 0) {
                  NSArray *response2 = response1[0];
                  if (response2.count &gt; 1) {
                      jsonAsString = response2[1];
                  }
              }
          }
  
          @try {
              NSData *jsonAsData = [jsonAsString dataUsingEncoding:NSUTF8StringEncoding];
  
              NSError *error;
  
              NSDictionary *json = [
                NSJSONSerialization
                JSONObjectWithData:jsonAsData
                options:NSJSONReadingMutableContainers
                error:&amp;error
              ];
  
              completion(json, error);
          }
          @catch (NSException *exception) {
              NSLog(@"error: %@", exception.reason);
  
              NSMutableDictionary * info = [NSMutableDictionary dictionary];
              [info setValue:exception.name forKey:@"ExceptionName"];
              [info setValue:exception.reason forKey:@"ExceptionReason"];
              [info setValue:exception.callStackReturnAddresses forKey:@"ExceptionCallStackReturnAddresses"];
              [info setValue:exception.callStackSymbols forKey:@"ExceptionCallStackSymbols"];
              [info setValue:exception.userInfo forKey:@"ExceptionUserInfo"];
  
              NSError *error = [[NSError alloc] initWithDomain:@"" code:1 userInfo:info];
  
              completion(nil, error);
          }
      };
  
      // RCTAsyncLocalStorage *storage = [RCTAsyncLocalStorage new];
      RCTAsyncLocalStorage *storage = [[RCTAsyncLocalStorage alloc] init];
  
      dispatch_async(storage.methodQueue, ^{
          @try {
              // [storage performSelector:@selector(multiGet:callback:) withObject:@[key] withObject:rnCompletion];
              [storage performSelector:@selector(getAllKeys:callback:) withObject:rnCompletion];
          }
          @catch (NSException *exception) {
              NSLog(@"error: %@", exception.reason);
          }
      });
  }
  </code></pre>
  
  <p>When I try to get one of my keys <code>(multiGet)</code></p>
  
  <pre><code>[self jsonFromLocalRNStrogeForKey:@"session" completion:^(NSDictionary* data,NSError* error) {
      if (data) {
          NSString * name = [data valueForKeyPath: @"token"];
          if (![name isKindOfClass:[NSNull class]]) {
              [self reportIncomingCallFrom:name withUUID:callInvite.uuid];
          }
      } else {
          NSLog(@"error: JSON Parsing Error: %@",error.localizedFailureReason);
      }
  }];
  </code></pre>
  
  <p>I'm always getting null</p>
  
  <p><a href="https://i.stack.imgur.com/qYFF8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qYFF8.png" alt="enter image description here"></a></p>
  
  <p>And when I try to get all the keys <code>(...@selector(getAllKeys:...)</code> to see what do I have in my AsyncStorage I got the exception</p>
  
  <pre><code>@"NSInvalidArgumentException" - reason: @"-[RCTAsyncLocalStorage getAllKeys:callback:]: unrecognized selector sent to instance 0x1085512c0"
  </code></pre>
  
  <p>The RN have <code>RCT_EXPORT_METHOD(getAllKeys:(RCTResponseSenderBlock)callback)</code> in <em>RCTAsyncLocalStorage.m</em>; but at <em>RCTAsyncLocalStorage.h</em> <code>(void)getAllKeys:(RCTResponseSenderBlock)callback</code> it doesn't exists and even adding it doesn't work (<a href="https://github.com/facebook/react-native/blob/master/React/Modules/RCTAsyncLocalStorage.h" rel="nofollow noreferrer">https://github.com/facebook/react-native/blob/master/React/Modules/RCTAsyncLocalStorage.h</a>).</p>
  
  <hr>
  
  <pre><code>"react-native": "^0.48.4",
  </code></pre>
  
  <p><a href="https://stackoverflow.com/questions/48232786/how-can-i-return-nsjsonserialization">How can I return NSJsonSerialization</a></p>