Easy way to list Third-Party Libraries Licenses in your iOS app

Easy way to list Third-Party Libraries Licenses in your iOS app

We all have added a library we found on GitHub to our project to do our life more easier. But did you know most of these libraries comes with some rules who need to read before do anything with that?

Alamofire’s license, one of the most popular 3rd party library in iOS

This is called License or Copyright, to protect the developer of the library from unfair use from the people who use it. Usually, they are licensed under the MIT License or Apache License 2.0

MIT License
Apache License 2.0

And we need to add them to your app.

CocoaPods made it easier and saved us from that pain with Acknowledgements.

Today I’m going to saw you how to do it very easily without worrying about it anymore.

Some popular apps use this method (From left to right: Paypal, Firefox Focus, Yr.no)

Let’s get started

We already have a ios project with pods installed, and the Podfile look like this:

This is how may your pod file look like right now

Creating Settings Bundle

Now let’s go to our ios project create a folder called Resources by right-clicking on our project and choosing New Group:

Right-Click on the project and choose New Group

After we gave it the name Resources to the folder, our project looks like this:

The folder ‘Resources’ in our project.

Now, right-click on the Resources folder and choose New File…

Right-click on the Resources folder and choose New File…

In the new window, in the Filter (top right corner) type settings, and choose Settings Bundle under the Resource section:

Type ‘settings’ in the Filter field and choose ‘Settings Bundle’ under the ‘Resource’ section

Then press Next and Create.

Setting up our Podfile

Now that we have created our Settings Bundle, we’re going to add the following code at the end of our Podfile:

Replace the name ‘LibrariesLicensesExample’ with your app’s name in line 11

Now let’s update our pods by typing pod update in the terminal:

Results of ‘pod update’

Let’s go and open our project again, and run the app

Hmmm… It seems that we don’t get the right results yet.

Final steps

Let’s go to our Settings.bundle we created earlier, and choose the Root.plist file:

Our Root.plist file inside the Settings.bundle we created earlier

Go and delete all the item under the Preference Items array EXCEPT from Item 0, so we don’t have to create a new one again.

So the Root.plist now looks like this:

Root.plist file after we deleted all the items expect from ‘Item 0’

Now change the Type from Group to Child Pane

Change Type from Group to Child Pane

For the Title, we give the name Acknowledgements

NOTE: You can give other title if you want. Like ‘Licenses’, ‘Open Source Libraries’, ‘3rd Party Libraries Licenses’

Title: ‘Acknowledgements’

And finally, we add one more row, by pressing the + button next to the Item 0, and we choose Filename from the dropdown menu and we give the value Acknowledgements

We add a new row ‘Filename’

So, in the end, our Root.plist looks like this:

Our ‘Root.plist’ at the end

Let’s build our project and run it!

You can find the final project here

If you have any questions feel free to DM me on Twitter @johncodeos or leave a comment below!

Leave a Reply

avatar
  Subscribe  
Notify of

Stay Connected

Newsletter

Subcribe for weekly emails! Get my posts of the week right in your inbox!