objective c - Read file in project directory from native iOS code? -


i have react-native application has settings in file called settings.json. read 1 of settings in file native ios code. tried code below:

nsfilemanager *filemgr; nsstring *currentpath; filemgr = [nsfilemanager defaultmanager]; currentpath = [filemgr currentdirectorypath]; nslog(@"value of filepath = %@", currentpath); 

but logs path / every time. how can path actual project this: /users/currentuser/documents/development/reactproject

i can't hardcode app. how can directory current react-native project?

you don't want project path either that's not available app under normal circumstances (it's in sandbox)

the thing think want is

  1. put file app bundle (just make sure it's in xcode group , assigned app target).

now deployed inside of app's bundle on whatever device it's on. it's read-only here.

  1. read using this:

    nsstring *filepath = [[nsbundle mainbundle] pathforresource:@"settings" oftype:@"json"];