Search code examples
delphifiremonkey

SaveState exception: Cannot Create file, Operation not permitted


I test SaveState on my iPad, I follow exactly the same logic on the embarcadero SaveState example, but it throws an exception after saving data.

However, the same logic tested on iOS Simulator is working fine. I am using Delphi 10.3.1 with an iPad iOS12.2

When I click the home button after the FormSaveState logic executed, the below exception occurred: Cannot create file ....... Operation not permitted the exception

The same logic tested on iOS Simulator is working fine. Any idea why this occurred and how to resolve? Thanks for any help!


Solution

  • use

    SaveState.StoragePath := System.IOUtils.TPath.GetTempPath
    

    and not

    SaveState.StoragePath := System.IOUtils.TPath.GetHomePath;