Posts

Post not yet marked as solved
3 Replies
360 Views
I have a very simple program, which works python kivy. In that program I read and write json files. Everything is fine with every simulator in Xcode Version 13.4. However when I connect my Phone it can read the json file but can't write in it. It says; `File "/Users/batuhan/programs/kivy-ios/2800-ios/YourApp/main.py", line 429, in secom PermissionError: [Errno 1] Operation not permitted: '/private/var/containers/Bundle/Application/C2508051-03DA-40EC-8587-A40D8B922055/2800.app/YourApp/savelist1.json' 2022-05-19 20:14:09.322995+0300 2800[3486:1776834] Application quit abnormally! 2022-05-19 20:14:09.416628+0300 2800[3486:1776834] Leaving` As I understand so far it is all about build settings in Xcode. Because as MacBook user I can write in that json file in simulator and everything works perfect. I need to give permission to write json file for every user, staff or everyone. I am just a beginner in Xcode, I think it is related with those settings; The json file is in same directory with main.py
Posted Last updated
.
Post not yet marked as solved
0 Replies
164 Views
I am in final phase of publish a nice game in App Store. However, I am stuck with a problem. In my app there are json files which saves and loads game in every step. They all works fine in Google Play Store. I have: macOS Big Sur 11.6 Python 3.10.4 XCode Version 13.2.1 iPhone 7 iOS 14.7.1 I have build the Xcode file with kivy-ios toolchain. I use those codes to read and write json files; #TO READ THE DATA FROM kel1.json: !!WORKS FINE!! file = open('kel1.json',"r",encoding='utf-8') klist = json.load(file) #TO CLEAN ALL THE DATA IN savelist1.json: !!GIVES ERROR!! telal={} json_objecti = json.dumps(telal) with open("savelist2.json", "w") as outfile: outfile.write(json_objecti). #TO APPEND A DATA IN savelist1.json: !!GIVES ERROR!! dict={aln:"item"} file=open("savelist1.json", "r+",encoding='utf-8') data = json.load(file) data.update(dict) file.seek(0) json.dump(data, file,ensure_ascii=False) as I said all above codes work fine when I turn that app to APK, AAB and after I publish the AAB to the GooglePlay. Also when I run simulation in Xcode, it works fine as well. But when I connect my phone and run the app, "r" json works but "r+" and "w" gives error; File "/Users/batuhan/programs/kivy-ios/2800-ios/YourApp/main.py", line 429, in secom PermissionError: [Errno 1] Operation not permitted: '/private/var/containers/Bundle/Application/C2508051-03DA-40EC-8587-A40D8B922055/2800.app/YourApp/savelist1.json' 2022-05-19 20:14:09.322995+0300 2800[3486:1776834] Application quit abnormally! 2022-05-19 20:14:09.416628+0300 2800[3486:1776834] Leaving I have found those and try; https://stackoverflow.com/questions/69491636/how-can-i-allow-permissions-for-my-kivy-app-to-access-text-files-when-running-on https://stackoverflow.com/questions/26322574/permission-denied-to-json-file-when-using-a-json-file-as-a-store-in-kivy-app https://stackoverflow.com/questions/66519444/python-kivy-on-ios-xcode-got-dlopen-error-on-foundation-image-not-fou https://stackoverflow.com/questions/24399958/kivy-error-on-ios-using-json-file-for-high-score What have I did so far; I gave all the permissions in security and privacy in 'full disk access', 'accessibility' and 'files and folders' for Xcode, python, terminal, finder. I manually give read&write privilege for every folder with every item inside them on folder info. I have tried to JSONStore but because of encoding problem I have dropped it. I have tried; path1=os.path.dirname(os.path.abspath(__file__)) tela={} json_object = json.dumps(tela, indent = 4) file_path1=os.path.join(path1,"savelist1.json") with open(file_path1, "w") as outfile: outfile.write(json_object) #THIS ONE WORKS FINE IN SIMULATOR BUT GIVES SAME ERROR IN PHONE AS WELL I have tried; tela={} json_object = json.dumps(tela, indent = 4) script_dir=os.path.dirname(__file__) file_path1=os.path.join(script_dir, "savelist1.json") with open(file_path1, "w") as outfile: outfile.write(json_object) #THIS ONE WORKS FINE IN SIMULATOR BUT GIVES SAME ERROR IN PHONE AS WELL I have cleaned and build folder in Xcode at every step. I have tried user_data_dir, but it returns the path to ~/Documents/<app_name> and json file is not there. Json files are in same folder with main.py and my.kv. I still can't find the right method to update json file in iPhone. Please help.
Posted Last updated
.