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

x/mobile: Info.plist not found for compiled xcframework #66018

Closed
Simon-Zeng opened this issue Feb 29, 2024 · 14 comments
Closed

x/mobile: Info.plist not found for compiled xcframework #66018

Simon-Zeng opened this issue Feb 29, 2024 · 14 comments
Labels
mobile Android, iOS, and x/mobile NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@Simon-Zeng
Copy link

Simon-Zeng commented Feb 29, 2024

Starting from XCode 15.3, each framework must have Info.plist located directly under framework root, otherwise app won't be able to run on Simulator (iOS device with iOS 17.4 or later?).
i.e. ProtonMail/gopenpgp#271

Screen Shot 2024-03-15 at 11 03 15
We don't have Info.plist file under gopenpgp.xcframework/ios-arm64_x86_64-simulator/Gopenpgp.framework/.

Could you please update procedure for "gomobile bind" to put an alias of Info.plist to framework root?
Thank you.

@gopherbot gopherbot added the mobile Android, iOS, and x/mobile label Feb 29, 2024
@gopherbot gopherbot added this to the Unreleased milestone Feb 29, 2024
@cagedmantis cagedmantis added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Feb 29, 2024
@cagedmantis
Copy link
Contributor

cc @hyangah

@scosman
Copy link

scosman commented Mar 14, 2024

Anyone have a workaround for this? I can create the needed Info.plist in framework root, but it fails parsing. Not sure which keys are needed.

@Simon-Zeng
Copy link
Author

Simon-Zeng commented Mar 15, 2024

Anyone have a workaround for this? I can create the needed Info.plist in framework root, but it fails parsing. Not sure which keys are needed.

@scosman Could you please add possibility for users to pass parameter with an URL value of Info.plist?
Some thing like ./gomobile bind -target iOS -plist $PLIST_FILE_PATH

@scosman
Copy link

scosman commented Mar 15, 2024

@Simon-Zeng I'm not a maintainer. Just trying to fix the same issue in my project, and get the info needed for the maintainers to make a quick fix. An alias won’t work as there are relative paths inside that top plist

@scosman
Copy link

scosman commented Mar 16, 2024

I've found a working fix manually. I think we need this built into the go mobile framework generator. Slightly confusing since it involves 2 Info.plist files.

First one: the generated framework needs an Info.plist in each of the generated NAME.framework subfolders. This can just be an empty plist:

<?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>
</dict>
</plist>

Second one: the existing Info.plist that is generated in each nested framework folder, in the subpath Versions/Current/Resources/Info.plist

Looks like Xcode 15.3 is expecting 2 properties here: CFBundleExecutable (the name of the static library file), and CFBundleIdentifier (a bundle ID, I use the same string as the CFBundleExecutable).

Example:

<?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>CFBundleExecutable</key>
        <string>Appcore</string>
        <key>CFBundleIdentifier</key>
        <string>Appcore</string>
</dict>
</plist>

There is a 3rd Info.plist at the root of the xcframework. There's no need to change that.

scosman added a commit to CriticalMoments/CriticalMoments that referenced this issue Mar 16, 2024
… plist formats in Appcore.xcframework

This is a workaround, bug on gomobile team is here: golang/go#66018
scosman added a commit to scosman/gomobile that referenced this issue Mar 16, 2024
This change adds compatibility for Xcode 15.3 to "gomobile bind" for building xcframeworks.

 - New blank Info.plist in the *.framework target root
 - Add CFBundleExecutable and CFBundleIdentifier to the resource level Info.plist

Tested locally on my framework on Xcode 15.3 (fixes issue) and 15.2 (doesn't create new issues).

Would love to get some more folks to try this fix, to make sure it works broadly.
@scosman
Copy link

scosman commented Mar 16, 2024

@Simon-Zeng mind testing my PR with a fix? Instructions in the PR.

golang/mobile#96

@gopherbot
Copy link

Change https://go.dev/cl/572175 mentions this issue: x/mobile: fix https://github.com/golang/go/issues/66018

@Simon-Zeng
Copy link
Author

@Simon-Zeng mind testing my PR with a fix? Instructions in the PR.

golang/mobile#96

It works for me. Thanks.

@dmitshur dmitshur added NeedsFix The path to resolution is known, but the work has not been done. and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Mar 18, 2024
gopherbot pushed a commit to golang/mobile that referenced this issue Mar 18, 2024
This change adds compatibility for Xcode 15.3 to "gomobile bind" for building xcframeworks.

 - New blank Info.plist in the *.framework target root
 - Add CFBundleExecutable and CFBundleIdentifier to the resource level Info.plist

Tested locally on my framework on Xcode 15.3 (fixes issue) and 15.2 (doesn't create new issues).

Would love to get some more folks to try this fix, to make sure it works broadly.

Note: I'm using the framework name as the bundleID. Some chance of collision here, but didn't want to add a required top level cmd parameter. I don't *think* a collision is a serious concern, but I'm not an apple build system expert.

To test:
 - sync my branch
 - build go mobile: `go build` in the `cmd/gomobile` dir
 - Build your xcframework with this version of go mobile: `gomobile bind ... `
 - Launch a project using the xcframework in Xcode 15.3, and run in simulator

Fixes golang/go#66018

Change-Id: I3e8ee99adb09071aa89a541dc97271a44b552ea3
GitHub-Last-Rev: 6277c7d
GitHub-Pull-Request: #96
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/572175
TryBot-Result: Gopher Robot <gobot@golang.org>
TryBot-Bypass: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Hajime Hoshi <hajimehoshi@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
hajimehoshi pushed a commit to ebitengine/gomobile that referenced this issue Mar 18, 2024
This change adds compatibility for Xcode 15.3 to "gomobile bind" for building xcframeworks.

 - New blank Info.plist in the *.framework target root
 - Add CFBundleExecutable and CFBundleIdentifier to the resource level Info.plist

Tested locally on my framework on Xcode 15.3 (fixes issue) and 15.2 (doesn't create new issues).

Would love to get some more folks to try this fix, to make sure it works broadly.

Note: I'm using the framework name as the bundleID. Some chance of collision here, but didn't want to add a required top level cmd parameter. I don't *think* a collision is a serious concern, but I'm not an apple build system expert.

To test:
 - sync my branch
 - build go mobile: `go build` in the `cmd/gomobile` dir
 - Build your xcframework with this version of go mobile: `gomobile bind ... `
 - Launch a project using the xcframework in Xcode 15.3, and run in simulator

Fixes golang/go#66018

Change-Id: I3e8ee99adb09071aa89a541dc97271a44b552ea3
GitHub-Last-Rev: 6277c7d
GitHub-Pull-Request: golang#96
Reviewed-on: https://go-review.googlesource.com/c/mobile/+/572175
TryBot-Result: Gopher Robot <gobot@golang.org>
TryBot-Bypass: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Hajime Hoshi <hajimehoshi@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
@Simon-Zeng
Copy link
Author

@scosman We had another issue when using framework built with gomibile on Xcode 15.3, but not sure whether it is related to Info.plist too:
1, Archive iOS project with frameworks updated by this fix
2, Export app for debug/ad-hoc distribution
3, Try to install apps on iOS devices, it will fail.

Or
1, Archive iOS project with frameworks updated by this fix
2, Validate the archive using Validate app in Archives panel of Xcode
3, Validation will raise error.

@scosman
Copy link

scosman commented Mar 20, 2024

I'm seeing issues as well.

Deploying to a real device gets and error: Failed to verify code signature of /var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.yIsKMw/extracted/voicebox.app/Frameworks/Appcore.framework : 0xe800801c (No code signature found.)

And on archive validation: No architectures in the binary. Lipo failed to detect any architectures in the bundle executable.

Can you add your error messages here @Simon-Zeng

@Simon-Zeng
Copy link
Author

Simon-Zeng commented Mar 21, 2024

@scosman
1, After we adjusted the places of framework content, parts of the validation issues disappeared.
It seems like Apple restricts where contents can be placed, please refer: https://developer.apple.com/documentation/bundleresources/placing_content_in_a_bundle

2, Regarding Info.plist, some keys are required now on Xcode 15.3:

  1. CFBundleExecutable
  2. CFBundleIdentifier
  3. CFBundleShortVersionString
  4. CFBundlePackageType
  5. MinimumOSVersion
  6. CFBundleName
  7. CFBundleVersion

p.s. Better use value 100.0 for MinimumOSVersion key, otherwise there may be strange issues.

@scosman
Copy link

scosman commented Mar 23, 2024

@Simon-Zeng can you provide some more details on what you moved to work with 15.3? I could fix gomobile but need specifics

@scosman
Copy link

scosman commented Mar 23, 2024

Okay, got it from the docs!

This fixes several issues:

  • Can run on device
  • Can archive+validate

I'll prob open a new issue for this and try a fix next week. The hard part will be keeping macos compatibility. The old system was to use symlinks to make it both work in same format. Now we'll need to maintain conditional targeting based on platform.

@hajimehoshi Any reason to not make this the new structure for iOS target?

@scosman
Copy link

scosman commented Mar 23, 2024

New issue here for the issue under discussion: #66500

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mobile Android, iOS, and x/mobile NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants