Is it possible to create in app's home dir (Documents or Library) dir/file using C++ code? I tried system()
and posix_spawn()
, which work on Simulator, but fail or real device (eg. running mkdir
). Core Foundation methods seem to give only read, not write possibility too.
Edit
In addition to answer below my simplified implementation of tar.gz unpacking using C++/Core Foundation here (ios.h/ios.mm)
You can get the home directory using the Core Foundation library's CFCopyHomeDirectoryURL() function. (This is a C function, no Objective-C required.) Using the CFURL accessors, you can pull the path from that and use it with standard C++ or C/POSIX file I/O functions. Or you can use Core Foundation for I/O directly.
You can't used posix_spawn
or system
or fork/exec*
in iOS due to sandboxing. No shell scripts either.