I have been working quite some time on version 1.3 of Copper, our Mac EDA application. Check it out if you didn’t know yet. This version brings the ability to import your own STEP models of parts to create wonderful 3D models of your PCB. And this feature also added a lot of (partly external) code to my project.
After archiving the project I wanted to upload it to the App Store. So I went in the Organizer of Xcode, selected the newly created archive and clicked on “Upload to App Store”. But, export failed. I got a strange “Copy failed” error with a hint to some logs. Reading these logs is hard. As I added various Frameworks and external libraries to my application I thought it must have been something to do with that. So, for many months I tried again and again, I ripped my project apart but I never really got this issue solved.
Looking at the logs I noticed that it points out:
...
2016-11-16 09:53:45 +0000 652253 bytes for ./Contents/Resources/woodTexture2.jpg
2016-11-16 09:53:45 +0000 /usr/bin/ditto exited with 1
2016-11-16 09:53:46 +0000 [MT] Canceled distribution assistant
I even contacted Apple Developer Technical Support. They could not verify this issue and haven’t been able to fix the issue. But one sentence of the support team made me stuck saying that it looks like a specific file (in this example woodTexture2.jpg) could be the issue. I should leave it out. To be fair it’s been a dylib that has been the last file before getting that error line in the log. But it still didn’t make sense to me. So I looked very closely at the log file again and finally saw these error lines:
2016-11-16 09:53:44 +0000 copying file ./Contents/Resources/CopperPreferences.storyboardc/4OD-OM-27I-view-dwl-fY-6Pq.nib ... 2016-11-16 09:53:44 +0000 ditto: /private/var/folders/0r/366qpcjd2bzc19yfqs90pz740000gn/T/XcodeDistPipeline.Lg1/Root/Applications/Copper.app/Contents/Resources/CopperPreferences.storyboardc/4OD-OM-27I-view-dwl-fY-6Pq.nib: Operation not permitted 2016-11-16 09:53:44 +0000 copying file ./Contents/Resources/CopperPreferences.storyboardc/AFPreferences2DViewer.nib ... 2016-11-16 09:53:44 +0000 ditto: /private/var/folders/0r/366qpcjd2bzc19yfqs90pz740000gn/T/XcodeDistPipeline.Lg1/Root/Applications/Copper.app/Contents/Resources/CopperPreferences.storyboardc/AFPreferences2DViewer.nib: Operation not permitted copying file ./Contents/Resources/CopperPreferences.storyboardc/AFPreferencesWindowController.nib ... 2016-11-16 09:53:44 +0000 ditto: /private/var/folders/0r/366qpcjd2bzc19yfqs90pz740000gn/T/XcodeDistPipeline.Lg1/Root/Applications/Copper.app/Contents/Resources/CopperPreferences.storyboardc/AFPreferencesWindowController.nib: Operation not permitted copying file ./Contents/Resources/CopperPreferences.storyboardc/Info.plist ... 2016-11-16 09:53:44 +0000 412 bytes for ./Contents/Resources/CopperPreferences.storyboardc/Info.plist 2016-11-16 09:53:44 +0000 copying file ./Contents/Resources/CopperPreferences.storyboardc/Jav-Q2-EM0-view-waA-Eu-cbU.nib ... ditto: /private/var/folders/0r/366qpcjd2bzc19yfqs90pz740000gn/T/XcodeDistPipeline.Lg1/Root/Applications/Copper.app/Contents/Resources/CopperPreferences.storyboardc/Jav-Q2-EM0-view-waA-Eu-cbU.nib: Operation not permitted copying file ./Contents/Resources/CopperPreferences.storyboardc/qo0-4Y-fgE-view-YZ5-Yh-mND.nib ... 2016-11-16 09:53:44 +0000 ditto: /private/var/folders/0r/366qpcjd2bzc19yfqs90pz740000gn/T/XcodeDistPipeline.Lg1/Root/Applications/Copper.app/Contents/Resources/CopperPreferences.storyboardc/qo0-4Y-fgE-view-YZ5-Yh-mND.nib: Operation not permitted
As you can see they all reference the CopperPreferences.storyboard. All other storyboards worked fine. Except this one. After checking my Git history I knew that Xcode created this file after I used the “Refactor to Storyboard” command in Interface Builder. The other storyboards don’t get referenced but this storyboard is referenced from my Main.storyboard.
Comparing both storyboards I noted that my Main.storyboard has been localized and was in the “Base.lproj” folder while my CopperPreferences.storyboard has been in the project root folder. After I clicked on CopperPreferences.storyboard and clicked on “Localize” in the inspector (first tab) it worked again.
So, this is a quick tip: Make sure that all your storyboards are localized when you reference them from other storyboards. As I got this error from Xcode 7.3 to 8.1 it doesn’t seem to be an issue in an isolated build!