<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Chausov on Medium]]></title>
        <description><![CDATA[Stories by Chausov on Medium]]></description>
        <link>https://medium.com/@chausov_88596?source=rss-875c8498ac94------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*k2mOAx-WNpF1wlqsUXpqSg.png</url>
            <title>Stories by Chausov on Medium</title>
            <link>https://medium.com/@chausov_88596?source=rss-875c8498ac94------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 27 Nov 2026 23:38:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@chausov_88596/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Recovering Lost Files in Several Xcode Targets]]></title>
            <link>https://medium.com/surf-dev/recovering-lost-files-in-several-xcode-targets-f341efefcaed?source=rss-875c8498ac94------2</link>
            <guid isPermaLink="false">https://medium.com/p/f341efefcaed</guid>
            <category><![CDATA[mobile-development]]></category>
            <category><![CDATA[xcode]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Chausov]]></dc:creator>
            <pubDate>Wed, 05 Feb 2020 09:44:35 GMT</pubDate>
            <atom:updated>2020-02-05T09:44:35.564Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*PcFuBUQ-0XuhYOp0Eajj7A.png" /></figure><p>Hi, my name’s Alexander and I’m an iOS-developer. In this article I will share my way of sparing myself the headache while working on a project with multiple targets.</p><p>“Why do you need multiple targets in a project?” you might ask. Here’s why. There was a project I once worked on, and it had one target linked to our client’s account:</p><ul><li>we didn’t have access to this account,</li><li>it was impossible to generate provisioning profiles and distribution certificates,</li><li>the most annoying thing was, we couldn’t add new devices to provisioning profiles.</li></ul><p>So when the company purchased new devices, it led to a whole series of negotiations with the client to link these to their account and be able to test on them.</p><p>The solution was obvious. We had to create a second target linked exclusively to our company, which would be similar to the main target apart from having a different Bundle ID.</p><p>So we did. The second target allowed us to develop independently of the developers on the client’s side. This solution saved our development process more than once. For instance, when the client’s devs deleted all our devices from the provisioning profile of the main target and we couldn’t run the app.</p><p>Multiple targets can come in handy when you need to:</p><ul><li>build multiple applications from the same code base but with different resources,</li><li>keep multiple instances of the application on the same device.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/1*QMT86r0hPCfc5Xh2pKAiAg.png" /></figure><p>Yet, working on multiple targets has its disadvantages, mainly the need to closely track the process of adding new files to the project. They are identical, thus, it’s necessary to check the boxes in front of both targets when adding a new file to the project.</p><p>It’s hard to keep track of in a large heterogeneous team of people with different skill levels and reliability.</p><p>If you neglect this, after the next merge you may find that one of the targets has stopped building and Xcode is complaining that it can’t find some class. It gets even more interesting if someone forgets to add a file from Copy Bundle to both targets (e.g. targets of a xib cell). Such an error can only be spotted in Runtime.</p><p>After we’d faced another problem with the Debug target, we decided to give control over consistency to a script. We chose the Ruby language because it has an excellent <a href="https://www.rubydoc.info/gems/xcodeproj/Xcodeproj/Project/Object/PBXFrameworksBuildPhase">xcodeproj</a> gem which is virtually a standard for making tools for iOS development (see Fastlane, Generamba, etc.).</p><p>In the end we developed a script that implements the following logic:</p><ul><li>path to the project file and names of the checked targets are submitted for input,</li><li>script finds the project,</li><li>it selects the desired targets and collects their files (Compile Sources, Copy Bundle Resources and Frameworks),</li><li>it searches for difference between file lists,</li><li>from there we exclude files featured in the whitelist, e.g. files with constants that differ depending on the target (baseUrl if applications from different targets access different servers) or GoogleService-Info.plist files that will vary for different targets.</li></ul><p>If the script finds differences, it means that you’ve got a problem. It means that some file or framework was only added to one target and not to both.</p><p>Hence, the script allows you to:</p><ul><li>make sure that all files from Compile Sources and Copy Bundle Resources were correctly added to both targets,</li><li>verify the identity of added framework lists which is essential if your project is based on a multi-module architecture,</li><li>integrating the script in Build Phase allows you to determine the problem before the actual build phase of the project,</li><li>even if you previously built both targets in CI, you can now build just one, thus reducing the build time in CI by half.</li></ul><p>In case of an error, you’ll see this message in Xcode:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*kPd9vLsUugtT6uyQywKUhA.png" /></figure><p>In case of a success you’ll get a unicorn:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/645/1*HlQ5rCmYq7BVZP-PKNp6Wg.png" /></figure><p>In this <a href="https://github.com/surfstudio/TargetsCheck">repository</a> you will find further instructions for adding this script to your project as well as settings and Example-project.</p><p>This utility illustrates that even iOS-developers can be creative in their daily work. Start the process of automation and write scripts that will make your life easier!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f341efefcaed" width="1" height="1" alt=""><hr><p><a href="https://medium.com/surf-dev/recovering-lost-files-in-several-xcode-targets-f341efefcaed">Recovering Lost Files in Several Xcode Targets</a> was originally published in <a href="https://medium.com/surf-dev">Surf</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>