Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App validation errors when submitting to App Store on Xcode 15.4 #181

Open
Pulstarter opened this issue Jul 16, 2024 · 15 comments
Open

App validation errors when submitting to App Store on Xcode 15.4 #181

Pulstarter opened this issue Jul 16, 2024 · 15 comments
Labels
bug Something isn't working

Comments

@Pulstarter
Copy link

Pulstarter commented Jul 16, 2024

Environment:

  • OS: MacOS Sonoma 14.5 on MacbookPro M1
  • Godot version: 4.2.2
  • godot-sqlite version: 4.3
  • Xcode 15.4

Issue description:
When trying to upload a release app to App Store, validation fails with these errors:

Asset validation failed
This bundle is invalid. The bundle at path Payload/sqlite.app/Frameworks/libgdsqlite.ios.template_release.arm64.framework has an invalid CFBundleIdentifier 'com.gdextension.framework.libgdsqlite.ios.template_release.arm64' There are invalid characters(characters that are not dots, hyphen and alphanumerics) that have been replaced with their code point 'com.gdextension.framework.libgdsqlite.ios.template\u005frelease.arm64' CFBundleIdentifier must be present, must contain only alphanumerics, dots, hyphens and must not end with a dot. [see the Core Foundation Keys at https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/TP40009249-102070-TPXREF105] (ID: e8319f15-7e57-4937-a351-36c53c0433dc)

Asset validation failed
Invalid Bundle. The bundle sqlite.app/Frameworks/libgdsqlite.ios.template_release.arm64.framework does not support the minimum OS Version specified in the Info.plist. (ID: 38532462-c628-4c17-9cf3-d706966b604c)

Steps to reproduce:
1.- Create new app in Godot 4.2.2 and make an empty scene for testing.
2.- Install godot-sqlite plugin from the AssetLib and activate.
3.- Export the app with IOS preset just filling App Store Team ID and Bundle Indentifier.
4.- Uncheck "Export with debug"
5.- Open the exported projects in Xcode and exec "Product -> Archive"
6.- When finish, press "Validate App" in the archives section.

Minimal reproduction project:
Just a new Godot 4.2.2 Project.

Additional context
The MinimumOSVersion in the global project is 12.0, but if we read this file:

<exported_dir>/sqlite/dylibs/addons/godot-sqlite/bin/libgdsqlite.ios.template_debug.arm64.framework/Info.plist

we can find that this key is 10.0

MinimumOSVersion
10.0

@Pulstarter Pulstarter added the bug Something isn't working label Jul 16, 2024
@2shady4u
Copy link
Owner

2shady4u commented Jul 17, 2024

Hello @Pulstarter

There are two possibilities:

  • It is an issue with my build settings for iOS --> I will double-check if my settings are outdated.
  • It is an issue with godot-cpp itself and I can't really solve it 😢 In that case you'll have to make a new issue in that repository since I won't be able to help you...

@2shady4u
Copy link
Owner

Hello 😄
I rebuild the iOS libraries using the latest macos runner:
https://github.com/2shady4u/godot-sqlite/actions/runs/9981544572

Could you check if that binary works better?

@Pulstarter
Copy link
Author

Thanks a lot for your effort and your package. However the result is the same. I have updated these files:

MD5 (libgdsqlite.ios.template_release.arm64.dylib) = b77482b71642b51a099656a8e85f24a1
MD5 (libgdsqlite.ios.template_debug.arm64.dylib) = 16fcfbf8959fbb453cfee5858b2ae101

And the messages are the same. I test to do not embed and sign the libdgsqlite.ios.template_release.arm64.framework in Xcode -> General -> Sqliteapp -> Frameworks, Libraries and Embedded Content, and the validation pass, but the app crashes at startup with an error. I know that it does not mean anything, but I paste it anyway :-D

dyld`:
    0x1b11decd0 <+0>:  mov    x16, #0x209
    0x1b11decd4 <+4>:  svc    #0x80
->  0x1b11decd8 <+8>:  b.lo   0x1b11decf8               ; <+40>
    0x1b11decdc <+12>: pacibsp 
    0x1b11dece0 <+16>: stp    x29, x30, [sp, #-0x10]!
    0x1b11dece4 <+20>: mov    x29, sp
    0x1b11dece8 <+24>: bl     0x1b1176618               ; cerror_nocancel
    0x1b11decec <+28>: mov    sp, x29
    0x1b11decf0 <+32>: ldp    x29, x30, [sp], #0x10
    0x1b11decf4 <+36>: retab  
    0x1b11decf8 <+40>: ret   

Best regards.

@2shady4u
Copy link
Owner

Hello @Pulstarter,

Here's another attempt at fixing the issue where I have modified the build system to:

  • Export the iOS library as a static library
  • Bundle the static libraries into a xcframework

Would it be possible to try with these new binaries?
They can be downloaded here:
https://github.com/2shady4u/godot-sqlite/actions/runs/10003299615

@Pulstarter
Copy link
Author

Hi! I am very sorry to bother your with this, but I don't know how to apply these last binaries to the current project. Do I need to add them in Xcode or in the addons folder?

Thanks

@2shady4u
Copy link
Owner

Hi! I am very sorry to bother your with this, but I don't know how to apply these last binaries to the current project. Do I need to add them in Xcode or in the addons folder?

Thanks

Hello! It should be in the addons/godot-sqlite/bin/-folder :)

Also you'll have to update the gdsqlite.gdextension-file, see here:
https://github.com/2shady4u/godot-sqlite/blob/feature/attempt-ios-fix/demo/addons/godot-sqlite/gdsqlite.gdextension

@Pulstarter
Copy link
Author

Pulstarter commented Jul 20, 2024

Hi! Thanks a lot. Unfortunately it does not work, but the error messages are different:

Asset validation failed
Unexpected file found in Frameworks. The “sqliteapp.app/Frameworks/libgodot-cpp.ios.template_debug.arm64.a, sqliteapp.app/Frameworks/libgdsqlite.ios.template_release.a” file is in the Frameworks directory, but the Swift runtime libraries are the only files permitted in that directory. Please remove this file and upload a new build. (ID: c6fa5985-b911-4b71-9d03-b29c4f5dc74a)

Asset validation failed
Invalid bundle structure. The “sqliteapp.app/Frameworks/libgodot-cpp.ios.template_debug.arm64.a” binary file is not permitted. Your app cannot contain standalone executables or libraries, other than a valid CFBundleExecutable of supported bundles. For details, visit: https://developer.apple.com/documentation/bundleresources/placing_content_in_a_bundle (ID: e2137553-807b-4661-a432-3720a4662110)

Asset validation failed
Invalid bundle structure. The “sqliteapp.app/Frameworks/libgdsqlite.ios.template_release.a” binary file is not permitted. Your app cannot contain standalone executables or libraries, other than a valid CFBundleExecutable of supported bundles. For details, visit: https://developer.apple.com/documentation/bundleresources/placing_content_in_a_bundle (ID: 02c54643-e379-4645-b0d4-48239ad8bff0)

If I don't embed them, I get a differente error too when running the app.

Hope it helps

@2shady4u
Copy link
Owner

Hi @Pulstarter :/

I am at a loss atm...
I made a new issue in the godot-cpp repository since they might better know how to help you:
godotengine/godot-cpp#1532

Please feel free to add more information or correct me if I wrote something wrong in that issue.

@Pulstarter
Copy link
Author

Pulstarter commented Jul 20, 2024

Hi again! First thank you for all the effort. Here's One little update. I have updated the filename for ios on the gdsqlite.gdextension file. I removed the underscore (release_) on both files and now their names are:

ios.arm64 = "res://addons/godot-sqlite/bin/libgdsqlite.ios.debug.arm64.dylib"
ios.template_release.arm64 = "res://addons/godot-sqlite/bin/libgdsqlite.ios.release.arm64.dylib"

Now when archive on xcode and test the app only appears this error:

**Invalid Bundle. The bundle sqlitetest.app/Frameworks/libgdsqlite.ios.release.arm64.framework does not support the minimum OS Version specified in the Info.plist. (ID: 4a0d8426-505f-4c40-9e11-7ba4055c06ba)**

I test with both original files and modified ones and the result is the same. I see that on this path:

<export_path>/SqliteTest/sqlitetest/dylibs/addons/godot-sqlite/bin/libgdsqlite.ios.release.arm64.framework

there is a file Info.plist with MinimumOSVersion -> 10.0, but on Xcode, minimun version is 12.0.

From here I don't know if you can do that this Info.plist target MinimumOSVersion 12.0 or is a Godot Engine task when exporting.

@2shady4u
Copy link
Owner

Maybe related:
godotengine/godot#84162

@Pulstarter
Copy link
Author

Pulstarter commented Jul 22, 2024

Hi! I have tested it on Godot 4.3.beta3 and now it the Min IOS version is configurable in the editor. Now appear another error, but this is more related to the editor rather than the plugin:

ld: file cannot be mmap()ed, errno=22 path=sqlitetest/dylibs/addons/godot-sqlite/bin/libgdsqlite.ios.debug.arm64.framework/libgdsqlite.ios.debug.arm64 in 'sqlitetest/dylibs/addons/godot-sqlite/bin/libgdsqlite.ios.debug.arm64.framework/libgdsqlite.ios.debug.arm64' clang: error: linker command failed with exit code 1 (use -v to see invocation)

I see that there is an issue opened with the same problem:

godotengine/godot#90168

So I think this one can be closed because it is not a problem of this plugin.

@jgestiot
Copy link

jgestiot commented Jul 22, 2024 via email

@2shady4u
Copy link
Owner

I think you change this behaviour when you click on the little arrow next to the "Watch" button
image

@IainBerliner
Copy link

IainBerliner commented Jul 28, 2024

Hi all. I would like to show what I believe the issue to be and demonstrate what
(I think) is the correct solution, which I found.

As Pulstarter noted, these are two separate problems, one of which can be solved
simply by changing the "template_debug"/"template_release" folder name to
"debug"/"release" without the underscore, and updating the file path in the
gdsqlite.gdextension file to reflect this.

The other fix seems to be a linker-related issue. The way compiling for iOS works is
that there is an SDK version that you compile from, but then a minimum iOS version
that you link to, specified by the linker-flag -miphoneos-version-min. If this is not
specified the minimum iOS version the binary links to defaults to the SDK version that
you compiled with.

You can view the minimum iOS version that is being linked to with the command:
"vtool -show libgdsqlite.ios.debug.arm64" on the binary, and this will confirm
that the minimum version is not 12.0 like it should be.

BUT the fix is quite simple because linking happens at run-time and thus can be changed
retroactively. All you need to do is run the following command on the binary:

"vtool -set-build-version ios 12.0 15.2 -tool -ld 711.0 -output libgdsqlite.ios.debug.arm64 libgdsqlite.ios.debug.arm64"

and you can set the minimum ios version that is linked to be 12.0 instead of 15.2.

A word of caution: this would not work on all binaries or automagically solve
compatability issues if a binary uses features specific to a version higher than
12.0. But because this binary doesn't appear to do that, I think this is fine.
But, I still haven't tested this on a 12.0 phone/simulator so I'm not going to
claim this with 100% certainty.

ANOTHER step that is necessary is changing the minimum os version specified in the
Info.plist file beside the binary in the exported project to be 12.0 as well,
instead of the default 10.0. If you run the vtool command on the binary but forget
to do this, you will still get the same error!

I'm not sure how this repository could be updated so these manual steps are not
required, but I think a start would be setting the linker flag
'-miphoneos-version-min=12.0' in the SConstruct file. There's the issue that Godot
still might set the incorrect version in the generated Info.plist, meaning users will
have to manually configure that every time they want to upload an iOS app containing
this repository, but I wouldn't know how to solve that. There also remains the other,
underscore-related issue causing validation errors, which requires manual-labor to
fix.

If for some reason you are targeting a different minimum iOS version other than 12.0,
these steps are the same, but substitute 12.0 in the steps for the minimum iOS version
you targeting e.g. "13.0".

Hope that helps!

@IainBerliner
Copy link

IainBerliner commented Aug 20, 2024

FURTHER UPDATE:

I bought one month's worth of access to a real-device testing platform in order to test my app on different phone models (to get the scaling right) and also to ensure there were no compatibility issues (I was worried my workaround for getting this repository's binary to validate might cause issues).

What I discovered is that the "mobile" renderer has a minimum iOS version requirement of 16.0. I did not test the "forward+" renderer but I think this is the same as well. Then, the "compatibility" renderer has a minimum iOS version of 14.1. I couldn't test 14.0 as the real-device testing platform didn't have a phone with this version, all I know is 13.X all resulted in crashes on startup and 14.1+ didn't crash at all with the "compatability" renderer.

BUT in 0 cases were there any compatibility issues due to this code repository while employing the workaround that I have shared here for getting the app validation to work. All the crashes seem to have been due to the various Godot renderers being used on unsupported iOS versions, not this repository failing. My only recommendation would be that if anyone publishes a Godot app on iOS, they should keep in mind the minimum iOS compatibility version of the renderers (which I more or less found through trial-and-error).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants