Monthly Archives: May 2017

iOS App Store Submission headaches

At work, from time to time we have to update our app. With Android the process (automated in TeamCity) goes smoothly. With iOS, if you are reading this chances are that you already know that it can be quite a pain: expired certificates, Mac OS updates, Xcode updates (at the moment of writing we use Xcode 8.2.1), plist updates, command line commands updates... even if you want to use an old system you can't, you always need to update something (grr!).

In our TeamCity setup, we have the following 2 steps:

echo "Step 1: Building xcode project..."
 xcodebuild \\
 -configuration Release \\
 -project "./myapp.xcodeproj" \\
 -scheme "MyApp" \\
 -archivePath "./build/myapp.xcarchive" \\
 clean build archive

and:
echo "Step 2: Exporting application..."
 xcodebuild \\
 -configuration Release \\
 -exportArchive \\
 -exportFormat ipa \\
 -archivePath "./build/myapp.xcarchive" \\
 -exportPath "./build/myapp.ipa"

After the second step, we normally get an IPA file and upload it to itunes connect via Application Loader. In the last week, after apparently successful upload, as usual I checked in itunes connect > my app > activity > all builds, but I could not see the build! I waited a few more minutes, nothing. Usually it should be visible as "processing" and that can take some more time, but I was worried to see nothing at all... so I checked the command line output and noticed:
Codesign check fails : /var/folders/vk/.../myapp.app: a sealed resource is missing or invalid

and also:
xcodebuild: WARNING: -exportArchive without -exportOptionsPlist is deprecated

So I thought that maybe it would work better using the Xcode UI: "Product" > Archive, then "Window" > Organizer > Upload to App Store... this somehow gave more feedback:
ERROR ITMS-90035: "Invalid Signature. A sealed resource is missing or invalid.[...]"

Seems the same problem, but this time I could see the error upon upload attempts. So as suggested in this blog post by Ash: iOS App Store Submission Problems I added an export.plist file containing just the bare minimum:
<?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>teamID</key>
 <string>MYTEAMID123</string>
 <key>method</key>
 <string>app-store</string>
 <key>uploadSymbols</key>
 <true/>
</dict>
</plist>

I had to find out our team id: https://developer.apple.com/account/#/membership

Then I adapted the export step and added the exportOptionsPlist option, like this:

echo "Exporting application..."
 xcodebuild \\
 -configuration Release \\
 -exportArchive \\
 -exportOptionsPlist export.plist \\
 -archivePath "./build/myapp.xcarchive" \\
 -exportPath "./build/"

I could upload the resulting IPA via Application Loader and could see the build processing in Itunes Connect, but then it disappeared after a few seconds (I was reloading the page to see if there were updates). This time my boss received an e-mail that something was wrong. In our case:
*Missing Info.plist key* - This app attempts to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSCameraUsageDescription key with a string value explaining to the user how the app uses this data.

After adding the missing info.plist key and value, the app could be uploaded and processed without problems. The story, written like this seems kinda easy, but I wasted at least half a day to try different commands and figuring out the proper solution. Sharing in the hope to help a poor soul with similar/same problems, as Ash did (thx man!). Good luck!