I'm start to implementing a simple feature but got stuck on the iOS native side, I'm not an experienced iOS dev so bear with me on this.
What I need is a way on the native side read/write the Asyncstorage while keep the functionality on the React Native side (because the JS thread will be dead after the app is in the bg for a while)
What I've done:
#import <RNCAsyncStorage/RNCAsyncStorage.h>NSString *result = [[[RNCAsyncStorage alloc] init] _getValueForKey], but I got an error stating No visible @interface for 'RNCAsyncStorage' declares the selector '_getValueForKey'Any idea how this should be implemented? Thanks!
Hey @DevArenaCN
You can have a look at brownfield integration docs for iOS
Hey @DevArenaCN
You can have a look at brownfield integration docs for iOS
I've checked the brownfield doc, to my understanding even though I don't actually need to reinvent the wheels here, I'd still need to implement the delegate for every listed protocols, right?
Yes, that's correct
Gotcha, thanks for clearing that up for me.
Yes, that's correct
Another question, and it's been haunting me for a while now.?
RNCAsyncStorage *asyncStorage = [bridge moduleForClass:[RNCAsyncStorage class]];
asyncStorage.delegate = self;
I have there declared in my init for the delegate that I'm implementing, but I keep getting Use of undeclared identifier 'bridge'. I already imported RCTBridge, anything I did wrong?
So I have get the example app locally and have it built and up and running, from the source code it seems like you could toggle the set/unset delegate via dev menu, however I didn't see it shown (cmd+d), should it be at another place?
Also, I've tried to set my delegate this way
_testDelegate = [RNCTestAsyncStorageDelegate new];
RNCAsyncStorage *asyncStorage = [bridge moduleForClass:[RNCAsyncStorage class]];
asyncStorage.delegate = _testDelegate;
And it seems like the delegate wasn't set after all. Anything I did wrong?