KjellConnelly / react-native-shared-group-preferences

127 stars 57 forks source link

Unable to build in IOS #10

Closed annraveendran closed 5 years ago

annraveendran commented 5 years ago

While building, getting below error:

node_modules/react-native-shared-group-preferences/ios/RNReactNativeSharedGroupPreferences.m:78:59: Use of undeclared identifier 'key'

Please fix it.

KjellConnelly commented 5 years ago

Not sure why it's not working for you. Works for me. You have the source code. Debug it and get back to me if my module is the actual issue, or it's something maybe you missed?

annraveendran commented 5 years ago

Hi, Thank you for the reply. I am getting this issue in RNReactNativeSharedGroupPreferences.m line number 78. Please check the below method, getting error in the highlighted line. My react-native version is '0.60.5'.

RCT_EXPORT_METHOD(getUrlToFile: (NSString )filenameAndKey :(NSString )appGroup :(NSDictionary *)options :(RCTResponseSenderBlock)callback) { if (![appGroup isEqualToString:appGroupName]) { mySharedDefaults = [[NSUserDefaults alloc] initWithSuiteName:appGroup]; } if (mySharedDefaults == nil) { // error code 0 == no user defaults with that suite name available callback(@[@0]); return; }

if ([mySharedDefaults valueForKey:filenameAndKey] == nil) {
    // error code 1 == suite has no value for that key
    callback(@[@1]);
    return;
}
**NSString *absolutePath = [[mySharedDefaults URLForKey:key] absolutePath];**
callback(@[[NSNull null], absolutePath]);

}

KjellConnelly commented 5 years ago

Whoops, that was my bad - I was writing some code a couple months ago to add new capabilities to this module, didn't complete it, and forgot about it. Then yesterday I got a pull request from someone, merged/pulled, and published a new version without realizing it contained all the new code I wrote.

Just added a new npm version. Try reinstalling and see if it works again. Sorry for the inconvenience!