This tutorial will explain how to add the automatically generated CocoaPods acknowledgements plist file to your app’s iOS settings page.
CocoaPods automatically creates an acknowledgements markdown and plist file with the license information of all the pods in you project. You can use the plist file to create an acknowledgements section in the iOS settings for your app.
Note: There is a bug in Xcode 7.2 UI for creating a Child Pane. Below is a workaround.
- In Xcode workspace, Create New File.. Resource..Settings Bundle.
- Right click Settings.bundle and select “Add Files to “Settings.bundle”…”
- Find the Pods-AppName-acknowledgements.plist file in the /Pods/Target Support Files/Pods-AppName directory
- Rename the file to just Pods-acknowledgements
- Select Root.plist
- Delete the pre populated preference items by selecting them and then pressing Backspace
- Right click and select “Show Raw Keys/Values”
- Add a new item to the PreferenceSpecifiers of any type.
- Change the value of Type to PSChildPaneSpecifier
- Create or set the Title attribute to ACKNOWLEDGEMENTS
- Create or set the File attribute to Pods-acknowledgements
- Delete the other unused attributes
- In the en.lproj folder open Root.strings, delete the default values and add the following:
"ACKNOWLEDGEMENTS" = "Acknowledgements";
- From your test device, delete the app and build to test. You will need to delete the app every time you make a change to the Settings.bundle.
- Go to the iOS settings app and browse down to your app name and select it. It should now have the below child pane.
- Create a script to copy the pod generated file over every time you make a build:
- In Xcode go to your project’s target. Select the Build Phases tab.
- If the Run Script section doesn’t already exist. Press the Plus icon and select “New Run Script Phase”. In the Run Script section insert the following copy command:
cp "/Path/To/ProjectName/Pods/Target Support Files/Pods-ProjectName/Pods-ProjectName-acknowledgements.plist" "/Path/To/ProjectName/Resources/Settings.bundle/Pods-acknowledgements.plist"
Get insights into your Apple Search Ads performance and optimize your bids and keywords for maximum revenue with Kitemetrics by Kitefaster.
Tested with the following versions:
- Xcode 7.2
- iOS 9.2.1
- Swift 2.1.1