2016-04-22 8 views
0

は、私がSettings.bundle/Root.plistファイル内のいくつかの設定を表示したいです。主に、モバイルアプリが使用しているバックエンド環境を表示して、テスター用に設定できるようにしたいと考えています。私のリリースビルドでXamarin StudioおよびiOS版:変更Root.plist私のデバッグビルドでコンパイル時に

、私はそれは常に生産を指すのでSettings.bundle/Root.plistファイルでこれらの設定を非表示にします。それは、実行時にファイルを変更することはできませんので、

どのように私は、コンパイル時にRoot.plistファイルを変更することができますか? OS-Xで

+0

私はまた助けるかもしれないあなたに関連する別の質問に答え:http://stackoverflow.com/a/36795389/4984832 – SushiHangover

+0

ヒント@SushiHangoverのおかげで。私はそれを撃つだろう。 – burnt1ce

+0

問題ありません、それが助けてくれることを願って... ;-) – SushiHangover

答えて

1

は、コマンドが.plistファイルを変更/一覧表示することができますPlistBuddyが呼ばれています。

/usr/libexec/PlistBuddy 
Usage: PlistBuddy [-cxh] <file.plist> 
    -c "<command>" execute command, otherwise run in interactive mode 
    -x output will be in the form of an xml plist where appropriate 
    -h print the complete help info, with command guide 

あなたは-c "Add"または-c "Set"または-c "Delete"コマンドを使用して.plistを変更するために、カスタムのMSBuildタスクを使用することができ、さまざまなコマンドを使用してのヘルプを表示する/usr/libexec/PlistBuddy -hを実行します。コンソールに出力し、あなたのiOSプロジェクトのルートディレクトリからのような

何かをXML形式で.plist


find . -name "Root.plist" | xargs -n 1 -J % /usr/libexec/PlistBuddy -x -c "Print" % 

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 
<plist version="1.0"> 
<dict> 
    <key>PreferenceSpecifiers</key> 
    <array> 
     <dict> 
      <key>Title</key> 
      <string>Debug Settings</string> 
      <key>Type</key> 
      <string>PSGroupSpecifier</string> 
     </dict> 
     <dict> 
      <key>DefaultValue</key> 
      <string>1</string> 
      <key>FalseValue</key> 
      <string>0</string> 
      <key>Key</key> 
      <string>__monotouch_debug_enabled</string> 
      <key>Title</key> 
      <string>Enabled</string> 
      <key>TrueValue</key> 
      <string>1</string> 
      <key>Type</key> 
      <string>PSToggleSwitchSpecifier</string> 
     </dict> 
     <dict> 
      <key>AutocapitalizationType</key> 
      <string>None</string> 
      <key>AutocorrectionType</key> 
      <string>No</string> 
      <key>DefaultValue</key> 
      <string>automatic</string> 
      <key>Key</key> 
      <string>__monodevelop_host</string> 
      <key>Title</key> 
      <string>Xamarin Studio Host</string> 
      <key>Type</key> 
      <string>PSTextFieldSpecifier</string> 
     </dict> 
    </array> 
    <key>StringsTable</key> 
    <string>Root</string> 
    <key>Title</key> 
    <string>AppSettings</string> 
</dict> 
</plist> 
関連する問題