在iOS平台上运行gomobile应该使用哪个版本及命令?(Golang)
在iOS平台上运行gomobile应该使用哪个版本及命令?(Golang) 我不小心将问题发布到了错误的地方(x/mobile: Basic app does not work on iOS simulator&macos · Issue #68726 · golang/go · GitHub),但使用以下命令构建的输出在macOS和iOS模拟器中打开时出现错误。
对于iOS:
gomobile build -target=ios -bundleid=org.golang.gomobiletest \
-o=basic.app golang.org/x/mobile/example/basic
对于macOS:
gomobile build -target=macos -bundleid=org.golang.gomobiletest \
-o=basic.app golang.org/x/mobile/example/basic
有人知道哪个版本的gomobile是兼容的吗?
谢谢!
更多关于在iOS平台上运行gomobile应该使用哪个版本及命令?(Golang)的实战教程也可以访问 https://www.itying.com/category-94-b0.html
1 回复
更多关于在iOS平台上运行gomobile应该使用哪个版本及命令?(Golang)的实战系列教程也可以访问 https://www.itying.com/category-94-b0.html
根据你的问题,你遇到的错误很可能与Go版本和gomobile的兼容性有关。目前,gomobile已集成到Go工具链中,不再需要单独安装。建议使用Go 1.21或更高版本,因为这些版本包含了对iOS和macOS构建的更新支持。
对于iOS,使用以下命令构建:
go install golang.org/x/mobile/cmd/gomobile@latest
gomobile init
gomobile build -target=ios -bundleid=org.golang.gomobiletest -o=basic.app golang.org/x/mobile/example/basic
对于macOS,使用以下命令构建:
gomobile build -target=macos -bundleid=org.golang.gomobiletest -o=basic.app golang.org/x/mobile/example/basic
确保你的Go版本至少为1.21,并更新gomobile到最新版本。如果问题仍然存在,检查Xcode命令行工具是否已安装,并确认iOS模拟器或macOS目标设置正确。

