问题
my phone was jailbreak,I want to write the files in /var/mobile/Documents/
, I using the NSFileManager
to working,but it cant working, I print the error
log was "The operation couldn’t be completed. Operation not permitted", ok,I think NSFileManager
just can using in sandbox
maybe that I using the C(fread and fwrite), but also the file just can read,cant write,how to fix it,I just want write the file to the outside of the sandbox
directory in my app?
回答1:
Have you tried doing with the default C standard IO method? This has worked perfectly for me in the past:
FILE *file = fopen("/debugging_private_data.txt", "w");
if(!file){
// log an error opening file
} else {
fprintf(file, "My value: %d\n", x);
fclose(file);
}
This creates the file debugging_private_data.txt at the root
directory. If you can write there (have root permission), you can write anywhere I guess.
来源:https://stackoverflow.com/questions/20113402/write-the-files-in-root-directory-in-jailbreak-phone-permitted