I am currently building an iOS application using Xamarin and was looking to implement a settings bundle so that our QA department can point the app to the appropriate API environment.
What I am looking at doing is including or excluding the Settings bundle in the Xamarin iOS app based on the build configuration as I may not want to expose this data to the user in Release mode.
Can you include or exclude the Settings bundle or even change the bundle that is compiled into the app based on the build configuration?
(I gotten asked this so many times :-) , I figured I would expand my original answer.)
So as an example, in
Debug
mode, I want to include aSetting.bundle
that consists ofRoot.plist
and a submenuExtra.plist
.In
Release
mode, I want to include a totally differentRoot.plist
and noExtra.plist
in the app'sSetting.bundle
My
.csproj
file is going to look like this:Note:
As shown below, in
Debug
Xamarin is including additional menu items into my Root.plist and inRelease
they are not. Also myAdditional Settings
submenu is no longer available and now are labeled withXXXX Release
Debug mode result:
Release mode result:
Apart from conditional including of different settings bundle you will probably also need to conditionally read the settings in your app. You can use conditional compilation to either read from settings or use hard coded values: