1.2 Submit and Screenshot Your iOS App With fastlane
In this lesson, I’ll show you how to use the fastlane snapshot and deliver tools to create a command-line driven workflow for taking screenshots of your app and uploading them to the iTunes Store. We’ll submit a multi-language iOS application for review, automatically creating screenshots for all languages and devices. We’ll also use fastlane’s workflow feature to chain those different actions together. Automating this process not only saves you time, but also reduces errors and allows you to publish more frequently.
To scaffold out the fastlane configuration files for an iOS app, simply install fastlane tools with:
xcode-select --install sudo gem install fastlane
and then run
fastlane init from your project directory. You’ll be prompted for your Apple ID, and the fastlane configuration files will be created within a
1.Submit and Screenshot Your iOS App With fastlane2 lessons, 12:33
1.2 Submit and Screenshot Your iOS App With fastlane
[SOUND] You have just finished creating and testing your application. And now is the time to submit it to the App store and present it there. With the ever increasing number of devices and sizes, doing so is becoming more and more difficult. If you support the iPad, you have six different screen sizes and you can create up to five screen shots each. If you support multiple languages you might want to show the screen shots in their respective language. This is even more. Six devices times five screen shots times five languages is 150 screen shots total. Hello and welcome to the coffee break course submit and screen shot your app at fastlane. I'm Marcus Mulberger, and in this course I will show you how to make all those screen shots again and again without lifting a finger. And also submit your app to the store with your command plan. To do this, we are going to use fastlane, which is an amazing set of tools for every possible way you want to interact with Apple regarding iOS development. In this course, we will be actively using the capabilities of deliver to upload metadata, screen shots and to binary to iTunes connect and snapshot, to create all those screen shots. You run this process, fastlane also uses gym to build the app using the command line. As an example app, I will use this simple one called MyEinsteinQuotes. Which is basically the default master detail template from Xcode. But instead of time stamps, it uses random quotes from Albert Einstein. I also localized the application to German and French. I set up the project with the correct signing identities and provisioning profiles. If you want to learn how to do that, watch my other coffee break course, provision and sign your IOS at the fastlane. Before we can start, we need to make sure we have the Xcode command line tools which we can install using Xcode select dash, dash install. If you already have that installed like I do, this error message will show. Then we need fastlane itself. It requires Ruby 2.0, which comes with Mac OS and reinstall since 109 mavericks. To install it, run gem install fastlane. If you are using the system for wider groovy version you will have to add sudo. This installation might take a while. We start thing off by running fastlane init. This will set up the project by using this tool suite. You will get asked what the email address you use to log in to iTunes Connect, and if you never used fastlane before, the password as well. To setup assistant will find the project and iTunes Connect and detect all the settings from the Xcode project as well. Fastlane creates a folder called Fastlane that contains all the configuration. I also added the app icon PNG which is just a 1024 by 1024 icon file. The Deliverfile is quite short and contains all the setting used for uploading. For instance you have to set the path to the app icon here. We will revisit it again later. The most important file however, is the fast file, it defines work flows, so called lanes that can be run different cases. Here we have the beta lane which will first compile the app with gym and then use pilot which is another fastlane tool to upload it to test flight for your beta users. The lane we are interested in, is the app store lane. Snapshot is commented out right now, but we want to enable it with this lane. Then it compiles the app of gym and finally it delivers the force option. To bypass any confirmation. I also want to submit it for review after uploading. So I can set it here. Before we set up snapshot, we'll have a look at the metadata. Here you will see a bunch of options. First a copyright file that needs to be set. Then we have a primary category. I'll use Lifestyle. You can also set subcategories if available. The second category is optional, but I'll choose reference here. The rest is all localized data. I will be entering all the required information before copying the folder or other languages. The description needs to be set, so need the keywords. The name comes prefilled from iTunes Connect. Then there are release notes and to support URL. Those are all are required. The reason this is split into so many files, is that it is very easy to see and get when something has changed. This also lets you keep track of all the changes you made to your app metadata. Something that is impossible with iTunes Connect itself. Now let's copy the en-US folder for German, and also for French. We can now localize our metadata. The German localization is pretty easy for me. So I'll quickly do that. My French isn't actually that great, so I'll leave the description in English. Keywords I can manage the name as well. We are almost done setting up everything except snapshot. We just have to go back to the deliver file and set the app review information which is a hash. The required fields are first name, last_name phone_number, I'll put a fake one in, and email_address. You can even set the pricing tier here. When you send this to Apple, however, that will be effective immediately. The last thing we'll need is the app rating config path which is a path to a JSON file. I'm going to add the file here and paste in the template from the fastlane documentation. You can put values between zero and two in most of these. To set up snapshot, we have to call snapshot init. It will recognize that we use fastlane, so it will put all its files into the fastlane folder. It also tells us what to do to set up snapshot in our app. First, we need to add the snapshot helper file to our UI test target. Now we have to set up snapshot for the app. First, we'll extract the app into the constant, then recall setup snapshot, with the app as a parameter. And finally, we can call launch on the app. I'm going to use the example test to create the screenshots. We can use the recording feature of Xcode to perform actions within the app. After stopping the recording, we will be good to go. Unfortunately, the way the recordings set up yet is only good for English. We'll have to edit the commands a little bit to make it language independent. Fortunately, there is a method called elementBoundByIndex we can use. So we want to first navigation bar, and the third button. Which is the right bar button. Sometimes Xcode presents you with different options. You can use to access the elements. Here we want to access the first file and tap that. Now we can add the snapshot locations. First, I want one that captures this date of the launch. Then after adding some entries, I'm using the number prefix to sort it correctly in iTunes Connect and keep track of how many screenshots I took. The third screenshot is of the detail page. To verify the commands all work, run the test in Xcode once. There's only one final configuration step we have to do before we can upload all the data to iTunes Connect. We need to change the snapfile. Thus, we need to uncommand the devices because we don't need the iPad's. We also don't want to use Italian. We want French as our third language. Now it's finally time for submission. We can just call fastlane with the appstore lane. First, we'll run snapshot to create all the screenshots. When it's finished, it will open an overview of all the screenshots it took for you to verify. Now it's upload time. First, it runs gym and then deliver to upload everything. This step takes awhile. Be patient and do something else. If you chose to auto submit the app for review, deliver will wait for the build to be processed. This can take a few minutes. Usually around five to ten. When you look at the admin iTunes Connect now, you can see all the screenshots, metadata, and languages. You can also see the selected price in tier and categories. When you first submit the app for review, it won't actually submit it. Since you have to answer some additional questions regarding cryptography, content rights, and the advertising identifier. After that, you're app is waiting for review. You can also use the continuous integration server, that completely automate this process. For instance, every time you push to a branch, you distribute test builds or even submit it as readed. As you can see fastlane can be a huge time saver. Snapshot alone is worth using it.