Saturday 14 December 2019

Replacing iOS .plist Array Properties in Azure Release Pipelines

.plist files are used by iOS applications to keep configuration properties. These files support arrays as configurations. In deployment process of Azure DevOps pipelines you may want to update these plist files to have values relevant to the target deployment environments. Let’s see usage of plistbuddy utility to update array items in plist files as the plutil ( is unable to apply the changes.
The plutil can insert arrays as described here . However, it is failing in replacing values in arrays in .plist files.
For example assume the below .plist file array element.

While trying to update arrays with plutil it always crashes with array out of bound errors.
Info.plist: Could not modify plist, error: Failed to insert value [ "msal701274c3-f6c1-4e9f-a2f0-3d30e709ab5a"] at key path CFBundleURLTypes.0.CFBundleURLSchemes with error -[__NSCFConstantString characterAtIndex:]: Range or index out of bounds
However, we can use plistbuddy commands as shown below to update such array items without any problems in Azure Pipelines.
/usr/libexec/PlistBuddy -c "Set :CFBundleURLTypes:0:CFBundleURLSchemes:0 $(authmsal)" $(ipaExtractPath)/Payload/$(iOSApp)/Info.plist

No comments:

Popular Posts