Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6056763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:24:48+00:00 2026-05-23T08:24:48+00:00

My iOS application uses a number of third party components licensed under Apache 2.0

  • 0

My iOS application uses a number of third party components licensed under Apache 2.0 and similar licenses, which requires me to include various bits of text, this kind of thing:

* Redistributions in binary form must reproduce the above copyright
  notice, this list of conditions and the following disclaimer in the
  documentation and/or other materials provided with the distribution.

There seems to be a reasonable precedent for putting this information under a ‘License’ subentry in settings bundle (on the ipad facebook, pages, keynote, numbers and wikipanion all seem to do this).

I’m struggling a bit to actually achieve the same though; I seem to need to split the text up line by line and enter into xcode a line at a time (and xcode4 seems to have a crashing problem when editing the plists).

It seems like the kind of thing that there’s almost certainly a somewhere script to do, or some simple way to do it that I’ve missed.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T08:24:48+00:00Added an answer on May 23, 2026 at 8:24 am

    I think I’ve now managed to solve all the problems I was running into.

    • It seems to be best to use group element titles to hold the licenses (this is what Apple do in the iWork apps). There is however a limit on the length of these (and I’ve not yet discovered exactly what the limit is), so you need to break each license file into multiple strings.
    • You can create a line break within these by include a literal carriage return (ie. otherwise known as ^M, \r or 0x0A)
    • Make sure not to include any literal “s mid-text. If you do, some or all of the strings in the file will get silently ignored.

    I’ve got a convenience script I use to help generate the .plist and .strings file, shown below.

    To use it:

    1. Create a ‘licenses’ directory under your project
    2. Put script into that directory
    3. Put each license into that directory, one per file, with filenames that end .license
    4. Perform any necessary reformatting on the licenses. (eg. remove extra spaces at the beginning of lines, ensure that there are no line breaks mid-paragraph). There should be a blank line in-between each paragraph
    5. Change to licenses directory & run the script
    6. Edit your settings bundle Root.plist to include a child section called ‘Acknowledgements’

    Here’s the script:

    #!/usr/bin/perl -w
    
    use strict;
    
    my $out = "../Settings.bundle/en.lproj/Acknowledgements.strings";
    my $plistout =  "../Settings.bundle/Acknowledgements.plist";
    
    unlink $out;
    
    open(my $outfh, '>', $out) or die $!;
    open(my $plistfh, '>', $plistout) or die $!;
    
    print $plistfh <<'EOD';
    <?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>StringsTable</key>
            <string>Acknowledgements</string>
            <key>PreferenceSpecifiers</key>
            <array>
    EOD
    for my $i (sort glob("*.license"))
    {
        my $value=`cat $i`;
        $value =~ s/\r//g;
        $value =~ s/\n/\r/g;
        $value =~ s/[ \t]+\r/\r/g;
        $value =~ s/\"/\'/g;
        my $key=$i;
        $key =~ s/\.license$//;
    
        my $cnt = 1;
        my $keynum = $key;
        for my $str (split /\r\r/, $value)
        {
            print $plistfh <<"EOD";
                    <dict>
                            <key>Type</key>
                            <string>PSGroupSpecifier</string>
                            <key>Title</key>
                            <string>$keynum</string>
                    </dict>
    EOD
    
            print $outfh "\"$keynum\" = \"$str\";\n";
            $keynum = $key.(++$cnt);
        }
    }
    
    print $plistfh <<'EOD';
            </array>
    </dict>
    </plist>
    EOD
    close($outfh);
    close($plistfh);
    

    Setting up your Settings.bundle

    If you haven’t created a Settings.bundle, go to File –> New –> New File…

    Under the Resource section, find the Settings Bundle. Use the default name and save it to the root of your project.

    Expand the Settings.bundle group and select Root.plist. You will need to add a new section where its key will be Preference Items of type Array. Add the following information:

    enter image description here

    The Filename key points to the plist that was created by this script. You can change the title to what ever you want.

    Execute Script At Build Time

    Also, if you want this script to run whenever you build your project, you can add a build phase to your target:

    1. Go to your project file
    2. Select the target
    3. Click the Build Phases tab
    4. In the lower right corner of that pane, click on ‘Add Build Phase’
    5. Select ‘Add Run Script’
    6. Drag and drop your perl script into the section for your script. Modify to look something like this:
    1. cd $SRCROOT/licenses ($SRCROOT points to the root of your project)
    2. ./yourScriptName.pl

    After you have finished that, you can drag the Run Script build phase sooner in the build process. You’ll want to move it up before Compile Sources so that the updates to your Settings Bundle get compiled and copied over.

    Update for iOS 7: iOS 7 seems to handle the “Title” key different and is messing up the rendered text. To fix that the generated Acknowledgements.plist needs to use the “FooterText” key instead of “Title”. This how to change the script:

    for my $str (split /\r\r/, $value)
    {
        print $plistfh <<"EOD";
                <dict>
                        <key>Type</key>
                        <string>PSGroupSpecifier</string>
                        <key>FooterText</key> # <= here is the change
                        <string>$keynum</string>
                </dict>
     EOD
    
        print $outfh "\"$keynum\" = \"$str\";\n";
        $keynum = $key.(++$cnt);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an iOS application which uses an UIStoryboard to control its flow. I
I'm working in an iOS application which uses libXML2 to read XML retrieved from
I have an application, which uses some 3rd party libraries, for example Tesseract library.
I'm developing an application for ios which uses sqlite3 I need to debug a
I am developing an IOS application, which uses web services (SOAP/WSDL). I have built
I'm developing web-application (and also native iOS app) that uses images from different websites.
All, I'm working on a web application for iOS that uses a fixed position
I am developing an iOS Application which loads its content from an XML-file over
I have an iOS application for which I want to create a ViewController programmatically.
I am developing an iOS application which resembles a musical instrument. I am trying

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.