Azure / azure-spatial-anchors-samples

Azure Spatial Anchors sample code
Other
293 stars 138 forks source link

iOS Store binary rejected by missing MinimumOSVersion #407

Open t5ujiri opened 1 year ago

t5ujiri commented 1 year ago

Description

The binary got rejected by app store, probably because of CoarseReloc.framework. The functionality of the app itself is fine.

Steps to reproduce the issue

  1. Build ios app
  2. Archive with flutter build, which generates ipa
  3. Upload to app store using transporter
  4. The ipa got rejected with message below
Asset validation failed (90081)
This bundle is invalid. Applications built for more than one architecture require an iOS Deployment Target of 3.0 or later.(ID: 6993092b-94c6-4243-b97e-57dcf87e8d77)

Asset validation failed (90360)
Missing Info.plist value. A value for the key 'MinimumOSVersion' in bundle Runner.app/Frameworks/CoarseReloc.framework is required.(ID: 5b4ccbb7-5868-4ed2-83d7-c53dac884d9d)

Asset validation failed (90208)
Invalid Bundle. The bundle Runner.app/Frameworks/CoarseReloc.framework does not support the minimum OS Version specified in the Info.plist.(ID: 376d5c3b-df07-450c-bcd4-cc3d10560ebb)

Expected behavior

The built ipa for store gets accepted.

Screenshots

https://gyazo.com/a56a1fbf655e02a9e48e02bc579e57d3

Development information (please complete the following information)

Additional context

CoarseReloc.framework and AzureSpatialAnchor.framework, UnityFramework.framework are linked to flutter application using UaaL. https://gyazo.com/c2677aa4be8e981131e45f5a11890c45

t5ujiri commented 1 year ago

At least, Info.plist in 2.11.0 version of CoarseReloc.framework has those properties

<?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>18G6020</string>
    <key>CFBundleDevelopmentRegion</key>
    <string>en</string>
    <key>CFBundleExecutable</key>
    <string>CoarseReloc</string>
    <key>CFBundleIdentifier</key>
    <string>com.microsoft.CoarseRelocalization</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleName</key>
    <string>CoarseReloc</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>17A820</string>
    <key>DTPlatformName</key>
    <string>iphoneos</string>
    <key>DTPlatformVersion</key>
    <string>13.1</string>
    <key>DTSDKBuild</key>
    <string>17A820</string>
    <key>DTSDKName</key>
    <string>iphoneos13.1</string>
    <key>DTXcode</key>
    <string>1110</string>
    <key>DTXcodeBuild</key>
    <string>11A1027</string>
    <key>MinimumOSVersion</key>
    <string>11.0</string>
    <key>UIDeviceFamily</key>
    <array>
        <integer>1</integer>
        <integer>2</integer>
    </array>
    <key>UIRequiredDeviceCapabilities</key>
    <array>
        <string>arm64</string>
    </array>
</dict>
</plist>

but lost in latest release

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>English</string>
    <key>CFBundleExecutable</key>
    <string>CoarseReloc</string>
    <key>CFBundleIconFile</key>
    <string></string>
    <key>CFBundleIdentifier</key>
    <string>com.microsoft.CoarseReloc</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundlePackageType</key>
    <string>FMWK</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string></string>
    <key>CFBundleShortVersionString</key>
    <string></string>
    <key>CSResourcesFileMapped</key>
    <true/>
</dict>
</plist>
t5ujiri commented 1 year ago

I managed to upload binary successfully by editing Info.plist inside CoarseReloc.framework manually to add MinimumOSVersion:11.0 👍 https://gyazo.com/2333ea5cb3cba451ca93e87253b06fda https://gyazo.com/02eb27680a5ed13bbf449fcf1fde0bda

t5ujiri commented 1 year ago

Is there any updates? It's quite tedious to modify info.plist for each build. As the developer seems to be on an extended holiday, the solution for now is to modify PackageCache. Image from Gyazo

jelmer3000 commented 1 year ago

Thank you! That's a workaround for an annoying bug. Microsoft should really fix this in the next version.

the-mad commented 1 year ago

For those of you still annoyed by this, here is a Build phase's script that you can add in Xcode to programmatically set the MinimumOSVersion of the CoarseReloc framework:

# Define the path to the Info.plist file of the embedded framework
INFO_PLIST_PATH="$SRCROOT/Pods/AzureSpatialAnchors/bin/frameworks/CoarseReloc.framework/Info.plist"

# Set the desired MinimumOSVersion
MINIMUM_OS_VERSION="11.0"

# Check if the MinimumOSVersion key exists in the Info.plist
if /usr/libexec/PlistBuddy -c "Print :MinimumOSVersion" "$INFO_PLIST_PATH" >/dev/null 2>&1; then
  # Key exists, so update its value
  /usr/libexec/PlistBuddy -c "Set :MinimumOSVersion $MINIMUM_OS_VERSION" "$INFO_PLIST_PATH"
else
  # Key doesn't exist, so create it
  /usr/libexec/PlistBuddy -c "Add :MinimumOSVersion string $MINIMUM_OS_VERSION" "$INFO_PLIST_PATH"
fi

Hope this helps :)

t5ujiri commented 1 year ago

Now AppStore demands for CFBundleVersion entry for CoarseReloc Framework.

t5ujiri commented 1 year ago

https://github.com/Azure/azure-spatial-anchors-samples/issues/407#issuecomment-1713433839

Custom Build Phase Script would be like this

# Define the path to the Info.plist file of the embedded framework
INFO_PLIST_PATH="$SRCROOT/UnityProject/Frameworks/com.microsoft.azure.spatial-anchors-sdk.ios/Plugins/iOS/CoarseReloc.framework/Info.plist"

# Set the desired MinimumOSVersion
MINIMUM_OS_VERSION="11.0"
BUNDLE_VERSION="1"

# Check if the MinimumOSVersion key exists in the Info.plist
if /usr/libexec/PlistBuddy -c "Print :MinimumOSVersion" "$INFO_PLIST_PATH" >/dev/null 2>&1; then
  # Key exists, so update its value
  /usr/libexec/PlistBuddy -c "Set :MinimumOSVersion $MINIMUM_OS_VERSION" "$INFO_PLIST_PATH"
else
  # Key doesn't exist, so create it
  /usr/libexec/PlistBuddy -c "Add :MinimumOSVersion string $MINIMUM_OS_VERSION" "$INFO_PLIST_PATH"
fi

# Check if the BUNDLE_VERSION key exists in the Info.plist
if /usr/libexec/PlistBuddy -c "Print :CFBundleVersion" "$INFO_PLIST_PATH" >/dev/null 2>&1; then
  # Key exists, so update its value
  /usr/libexec/PlistBuddy -c "Set :CFBundleVersion $BUNDLE_VERSION" "$INFO_PLIST_PATH"
else
  # Key doesn't exist, so create it
  /usr/libexec/PlistBuddy -c "Add :CFBundleVersion string $BUNDLE_VERSION" "$INFO_PLIST_PATH"
fi