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

Add missing method on iOS #5635

Merged
merged 2 commits into from
Mar 26, 2023
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
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
* None

### Fixed
* <How to hit and notice issue? what was the impact?> ([#????](https://github.com/realm/realm-js/issues/????), since v?.?.?)
* None
* Added a missing (internal) method on iOS. Building a React Native app will failed with the error `Undefined symbol: realm::set_default_realm_file_directory(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)`. ([#5633](https://github.com/realm/realm-js/issues/5633), since v11.6.0)

### Compatibility
* React Native >= v0.71.0
Expand Down
10 changes: 10 additions & 0 deletions src/ios/platform.mm
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,22 @@
return error.localizedDescription;
}

static std::string s_default_realm_directory;

namespace realm {

void set_default_realm_file_directory(std::string dir)
{
s_default_realm_directory = dir;
kneth marked this conversation as resolved.
Show resolved Hide resolved
}

std::string default_realm_file_directory()
{
std::string ret;
@autoreleasepool {
if (!s_default_realm_directory.empty()) {
return s_default_realm_directory;
}
#if TARGET_OS_IPHONE
// On iOS the Documents directory isn't user-visible, so put files there
NSString *path = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0];
Expand Down