Open sindresorhus opened 2 years ago
Apple reply:
It seems like the issue is resolved now, as you were able to successfully import the last several builds in App Store Connect. Please confirm the issue is resolved. If you would still like to submit the above as feedback, we’d be happy to submit it on your behalf.
My reply:
Cause: Turns out I had turned off compiler optimization in Xcode because of a Swift optimization bug and I had forgotten to turn it back on. Since there were no optimizations, the import was not removed as dead code.
However, I think my report is still valid. There may be situations where dead code removal is not possible. The build should not be failed because of simply importing a module. At minimum point 1 and 2 still apply.
In addition, for valid cases, it would be better to perform the validation locally instead of notifying the user later on and forcing them to upload a new build.
Description
I have some reusable code that’s included in all my apps that imports the “Photos” framework. The app in question does not use this code at all, but because of a configuration change in Xcode, it did not get optimized out (compilation mode in Xcode changed from “Whole Module” to “Incremental”). App Store Connect detected the “Photos” import, invalidated the binary, and sent an email telling me to add a
NSPhotoLibraryUsageDescription
usage string.There are many things wrong with this:
The app does not actually use this the “Photos” framework. It’s simply imported. Having to guard code behind compilation macros just to please App Store Connect is not desirable.
macOS already requires a sandbox entitlement to access the photo library (“com.apple.security.personal-information.photos-library”). So it would be better to check for that rather than an import in code that may not even be used. It would result in a lot less false-positives.
The email does not indicate exactly where in the code the violation occurs. There’s no other way to debug this than to submit new builds and hoping you managed to guess your way to the solution, which is a very time consuming and annoying process.
I have attached a screenshot of the incorrect violation email.
Files