If you use
swift package generate-xcodeproj to generate an Xcode project for a SPM package, App Store will reject any apps that adds this library with Carthage. This post will show you how to make App Store submission work.
I have some open source libraries that support CocoaPods and Carthage and was excited when Apple announced that SPM was coming to iOS, since it can solve many of the problems that are involved with these tools.
SPM doesn’t require you to have an Xcode project. However, if you want to support Carthage, add a demo app etc. you have to create a project alongside the package.
Since the libraries already supported CocoaPods and Carthage and had demo apps, I decided to keep the old projects around. This worked great at first, since it just required me to move source and test files to new folders. I published the updates and everything worked great with all dependency managers.
However, I soon noticed that the projects didn’t play well with SPM, e.g. when keeping them in sync with their respective library. I therefore decided to create new projects with
swift package generate-xcodeproj.
The project generation is quick and finishes in seconds. It produces a new Xcode project, which may seem fine at first. However, there are many problems with this project and its configuration. Shortly after recreating the projects and pushing out the changes, I started receiving reports that apps that used Carthage to add the libraries were being rejected when they were submitted to the App Store:
"This bundle Payload/Offgrid.app/Frameworks/XXX.framework is invalid. The Info.plist file is missing the required key: CFBundleVersion. Please find more information about CFBundleVersion at https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleversion"
I had a look at the libary’s
Info.plist, but found that the
CFBundleVersion key was actually defined in this file. The error message is therefore incorrect.
You can find a more detailed discussion about this problem here.
Instead of adjusting the
Info.plist, which is correct, select the project in the project navigator, select the library target, go to
Build Settings and search for
current project version. Instead of an empty value, enter
This will make App Store submission work once again, even when using Carthage.