问题
I am converting a Delphi windows app to be multi platform, a crucial part of the application is to be able to export some data files from an SQLite database to the host machine.
It works absolutely fine on windows and OSX, but when I deploy it to an iPad I get an error message stating :
Cannot create file "/var/mobile/Containers/Bundle/Application/9FFD6B02-1B3A-4F07-XXXXXXXXXXXXXXXXXX/AAG_Multi.app/Text/Templates/full Transcript.dwt
Operation not permitted
I tried TMemorystream as well, same result. The directory should exist as I called Tdirectory.Creatdirectory(fullPath) immediately prior to the TStreamCreate Line.
回答1:
You are not allowed to write to the application bundle.
You need to write to a directory that is writeable. For instance, TPath.GetHomePath
would return a directory to which you could write. Exactly what directory you should use, probably only you can decide.
来源:https://stackoverflow.com/questions/26467536/operation-not-permitted-when-trying-to-create-a-tfilestream-object-on-ios8