Retrieving the iOS document directory
After a long pause I finally started to work on my Pythonista app Rechtschreibung (see https://github.com/marcus67/rechtschreibung) again. I would like to publish it in the AppStore. As a first step I used the Xcode template to run the Python code in the emulator. I only worked partially. As I found out all the errors were due to the fact that I try to write files located in the bundle directory structure of my app (which is a big no-no in iOS). Instead I have to use the so-called "DocumentDirectory" which is provided by some library functions in Objective C (see e.g. https://stackoverflow.com/questions/4129576/writing-a-string-to-a-text-file-using-xcode-for-iphone-dev). The question is for me how to access these library functions in Pythonista. I would guess that
objc_utilmight help, but none of the identifiers mentioned in the stackoverflow example seem to correspond to Objective C classes. Does anybody have an idea as to how to do this? Thanks a lot!
NSHomeDirectory, for example, is a c function -- c.NSHomeDirectory -- but not the recommended way, apparantly. NSFileManager has some methods to get various system folders:
http://web.mit.edu/darwin/src/modules/Libc/include/NSSystemDirectories.h has the constants for the two arguments, but basically (9,1) returns Documents folder.