16

I have set my Facebook-AppId in the Info.plist. But I wish to edit it because its dynamic. How shall I do it programmatically?

Ambili B Menon
  • 1,249
  • 2
  • 14
  • 26

4 Answers4

15

Probably write in info.plist is not good idea and it doesn't work because you are trying to write the dictionary to a .plist file inside your App bundle, which is read only. Thus it would not work and also would have more rejection chances even if you get it done other way.

BTW why Info.Plist only? I mean why you can not have it in other way e.g nsuserdefaults or sql

Jigar Pandya
  • 6,004
  • 2
  • 27
  • 45
  • 1
    Jigar, I want to change URL types in info.plist runtime, will it possible as mentioned https://stackoverflow.com/questions/54684706/will-apple-reject-my-app-if-i-edit-my-info-plist-runtime?noredirect=1#comment96158315_54684706 – Aleem Feb 14 '19 at 07:24
8

You can't edit the Info.plist of your app. You don't have write access to that file (assuming you want to release this on the App Store).

DrummerB
  • 39,814
  • 12
  • 105
  • 142
2

The only way to write a plist file is to copy it from the bundle to the document folder of your app.

After that you can write. Here is a good tutorial but there are much more. Just google. http://ipgames.wordpress.com/tutorials/writeread-data-to-plist-file/

Jordi Kroon
  • 2,607
  • 3
  • 31
  • 55
-2

As per the accepted answer, it's not a good idea to edit Info.plist, plus it's read-only file. High chances it will get blocked by App Store.

But Hitting (Saving the file) Ctr + S helped.

Try other option like SQL

Vivek
  • 566
  • 5
  • 6
  • This is the same solution as in [the accepted answer](https://stackoverflow.com/a/12818184/2227743). – Eric Aya Mar 23 '23 at 08:35