As of macOS 10.15 target catalyst can be used to build an iPad app to run on macOS. Existing .Framework
built with gomobile produces the following error when targetting catalyst:
error: Building for Mac Catalyst, but the linked framework 'Sample.framework' was built for iOS + iOS Simulator.
You may need to restrict the platforms for which this framework should be linked in the target editor, or replace it with an XCFramework that supports both platforms. (in target 'MySampleApp' from project 'MySampleApp')
~~This PR adds a case for catalyst (although architecture is just amd64
) when configuring the environment for each architecture, providing the flags needed to enable the built .Framework
to be used with catalyst.~~
Fixes https://github.com/golang/go/issues/36856
Update 18-Jan-2021
This PR has been updated to provide nominally working support of .xcframework
generation with go1.15, which has removed support for some 32 bit architectures. See: https://github.com/dpwiese/mobile/pull/1#issuecomment-761931422. In addition, unlike https://github.com/dpwiese/mobile/pull/1 this PR doesn't require manual thinning or combining of the generated .framework
s for each of the various "architectures" - this is now done automatically.
Todo
Running go test
fails with the following.
bind_test.go:321: gomobile bind failed: exit status 1
/var/folders/rx/h40bjl5n0s1fvr5h2w278tm80000gn/T/gomobile-test335293790/gomobile: darwin-catalyst: go build -tags ios -buildmode=c-archive -o /var/folders/rx/h40bjl5n0s1fvr5h2w278tm80000gn/T/gomobile-work-224727912/Cgopkg-amd64.a ./gobind failed: exit status 1
go: cannot determine module path for source directory /private/var/folders/rx/h40bjl5n0s1fvr5h2w278tm80000gn/T/gomobile-work-224727912/src (outside GOPATH, module path must be specified)
Note: on current master
branch TestIOSBuild
fails