Swift .writeToFile does not update JSON file in mainBundle

后端 未结 1 1252
清酒与你
清酒与你 2020-12-21 18:09

I am trying a simple dictionary retrieve, update key value and write back to file. For some reason the writeToFile does not update the file in the main bundle.

the

相关标签:
1条回答
  • 2020-12-21 18:43

    You cannot write to the main bundle. All files in the bundle are read-only. Copy your file into the application documents directory before modifying it.

    If you need a different file in the bundle to include in your application, you can update it in the documents directory during development and then manually copy it to the bundle before shipping your app.

    0 讨论(0)
提交回复
热议问题