EmergeTools / SnapshotPreviews-iOS

Automatic snapshots from Xcode previews
MIT License
193 stars 6 forks source link

Xcode 15.3 Invalid Bundle #109

Closed adam-zethraeus closed 2 months ago

adam-zethraeus commented 3 months ago

I get the following error when trying to distribute an app containing the preview gallery after building in Xcode 15.3.

Invalid Bundle. The bundle MyApp.app/Frameworks/PreviewsSupport.framework does not support the minimum OS Version specified in the Info.plist.

noahsmartin commented 3 months ago

What minimum OS version are you targeting? Also, we don't recommend using this for production apps only internal debug builds, previews are generally stripped from release builds

suguruTakahashi-1234 commented 3 months ago

@noahsmartin

I also encountered the same error when I tried to distribute with TestFlight on Xcode Cloud.

we don't recommend using this for production apps only internal debug builds

I understand the above reasons, but I would like to distribute the apps not only for debugging by iOS engineers, but also for review by designers, so if possible, please make it possible to distribute the apps regardless of Xcode version.

ben-p-commits commented 3 months ago

@suguruTakahashi-1234 has a point, I think that's a really valid use case. I work on a project that uses previews in a "Release" context via TF-distributed builds for displaying components in isolation for testers, designers, etc.

+1 to supporting Release builds!

pgorrindo commented 2 months ago

We are seeing the same error in the original issue description.

Similar to other comments above, our use case is that we distribute QA and UAT builds to our team via TestFlight - would be nice to include PreviewGallery views in those TestFlight builds. Of course we wouldn't ship those views in a production release.

FWIW, our app only targets the iOS SDK - although has iPhone, iPad, and Mac (via iPad) as supported destinations:

Screenshot 2024-05-03 at 18 24 15

I'm assuming the "minimum OS Version" referenced in the error is the LSMinimumSystemVersion key in the Info.plist, referring to macOS. We currently have that set to 13.0; I tried bumping it to 14.0, but still get the same error result on submission to App Store Connect / TestFlight. (Our iOS deployment minimum version is 16.3)

Appreciate any thoughts or insights @noahsmartin

noahsmartin commented 2 months ago

Hey @pgorrindo the minimum version supported by the package is iOS 15: https://github.com/EmergeTools/SnapshotPreviews-iOS/blob/main/Package.swift#L8 can you try setting it to that and seeing if it works?

noahsmartin commented 2 months ago

Ah I mis-read, LSMinimumSystemVersion is for macOS (as you said) and I just fixed a bug where the wrong min macOS version was used in this PR: https://github.com/EmergeTools/SnapshotPreviews-iOS/pull/112 So this should be resolved with the latest version! (v0.8.9)

pgorrindo commented 2 months ago

Thanks @noahsmartin for being so responsive!

Unfortunately, this issue still occurs for me.

To be clear - PreviewGallery() works fine for me in local builds running within Simulator.app. It is just on submitting to TestFlight that the above error is kicked back on a submission to App Store Connect.

For the pkg version, I've tried main and also pinning to the 0.8.9 commit https://github.com/EmergeTools/SnapshotPreviews-iOS/commit/6b8aea1f2d03ab3617affd5d54487f57d1dda7a5 to see if your fix in #112 resolves this for me -- but unfortunately it doesn't. (And yeah, our iOS minimum version is 16.3, so that shouldn't be a problem with the pkg's minimum of 15)

(Side note: I can't get the Xcode dependency rule of "up to next major version" to work for SnapshotPreviews-iOS -- I'll kick the tires a bit more later today to see if I have something misconfigured or I'm doing something wrong on my end, but that dependency rule works for our other dependencies, so might be something specific to SnapshotPreviews-iOS? I'll open an issue if it seems it might not be specific to me, to see if other folks can replicate.) update: this was a local configuration issue, not replicable.

noahsmartin commented 2 months ago

@pgorrindo can you check the LSMinimumSystemVersion of the PreviewsSupport.framework in the app you are uploading? I just tried it and it's set to 12.0 now for me with the latest changes

pgorrindo commented 2 months ago

zounds! set to 15.0 for me - so I must be doing something wrong?

Full Info.plist, for reference:

<?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>BuildMachineOSBuild</key>
    <string>23E224</string>
    <key>CFBundleDevelopmentRegion</key>
    <string>en</string>
    <key>CFBundleExecutable</key>
    <string>PreviewsSupport</string>
    <key>CFBundleIdentifier</key>
    <string>com.emerge.PreviewsSupport</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>PreviewsSupport</string>
    <key>CFBundlePackageType</key>
    <string>FMWK</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0</string>
    <key>CFBundleSupportedPlatforms</key>
    <array>
        <string>iPhoneOS</string>
    </array>
    <key>CFBundleVersion</key>
    <string>1</string>
    <key>DTCompiler</key>
    <string>com.apple.compilers.llvm.clang.1_0</string>
    <key>DTPlatformBuild</key>
    <string>21C52</string>
    <key>DTPlatformName</key>
    <string>iphoneos</string>
    <key>DTPlatformVersion</key>
    <string>17.2</string>
    <key>DTSDKBuild</key>
    <string>21C52</string>
    <key>DTSDKName</key>
    <string>iphoneos17.2</string>
    <key>DTXcode</key>
    <string>1520</string>
    <key>DTXcodeBuild</key>
    <string>15C500b</string>
    <key>MinimumOSVersion</key>
    <string>15.0</string>
    <key>UIDeviceFamily</key>
    <array>
        <integer>1</integer>
        <integer>2</integer>
    </array>
    <key>UIRequiredDeviceCapabilities</key>
    <array>
        <string>arm64</string>
    </array>
</dict>
</plist>
pgorrindo commented 2 months ago

oh wait, in that above plist @noahsmartin the key the I saw for 15.0 was MinimumOSVersion not LSMinimumSystemVersion (sorry, scanned the plist too quickly) - which is absent in the above. (MinimumOSVersion of course being for non-macOS OS versions)

pgorrindo commented 2 months ago

Since the key names are ambiguously similar (and re-reading the original error message of "PreviewsSupport.framework does not support the minimum OS Version specified in the Info.plist" - now I see that is is unclear if the App Store Connect error message is referring to MinimumOSVersion or LSMinimumSystemVersion) -- out of curiosity I explicitly added MinimumOSVersion to our app's Info.plist to set the non-macOS minimum to 16.3 for the target (which is already specified in the General tab of the target as the Minimum Deployment), and same result, same error as above. Note that LSMinimumSystemVersion was already explicitly specified in our Info.plist.

Screenshot 2024-05-06 at 13 12 56

Heading offline for a few hours in case I am slow to respond 😇

noahsmartin commented 2 months ago

Going to re-open and keep working on this, thanks for the details @pgorrindo !

noahsmartin commented 2 months ago

@pgorrindo I just released v0.8.10 that changes PreviewSupport.xcframework to be a dynamic lib instead of static. It looks like what was happening is the static lib would get compiled into a dynamic framework using the min OS version of your app, and then mismatch the min OS version in the framework's Info.plist. This should be fixed now with the dynamic framework always using 15.0 as the min iOS version. Let me know if you still run into any issues!

pgorrindo commented 2 months ago

woohoo! v0.8.10 resolves this issue for me -- thanks @noahsmartin for the quick turnaround and the explanation 🚀