Gomobile Installed in Mac
Download pkg
You might download golang's latest release in Mac.
https://storage.googleapis.com/golang/go1.8.3.darwin-amd64.pkgAnd intall it by double click it.
Environment
It will install package under /Users/xxx/go
junmeinde-MacBook-Pro:src junmein$ pwd
/Users/junmein/go/srcAdding GOPATH
junmeinde-MacBook-Pro:src junmein$ export GOPATH=/Users/junmein/goInstall Gomobile and Build Framework In Mac
Get gomobile
go get golang.org/x/mobile/cmd/gomobileBinding You golang code to IOS
junmeinde-MacBook-Pro:src junmein$ /Users/junmein/go/bin/gomobile bind -target=ios golang.org/x/mobile/example/bind/helloYou will get Hello.framework for IOS
junmeinde-MacBook-Pro:src junmein$ ls
Hello.framework golang.orgCompile Hello.Framework in Xcode
Put Hello.Framework in xcode
drag and drop hello.framework to xcode project
Adding code to existed code
import Hello
.
.
.
let msg = HelloGreetings("golang haha")Disable Bitcode check
Project -> search -> bicode -> noIf you ignore this steps, it will case the errors
error
link comand failed xcode frameworkThanks for this blog, it really help me a lot
https://medium.com/@fzambia/going-mobile-adapting-centrifugo-go-websocket-client-to-be-used-for-ios-and-android-app-e72dc2736f01
Result
You can download the result from my github
https://github.com/jonahwu/gomobileMore
Gomobile Installed in Ubuntu
It failed and with this exception.
/root/golang/bin/gomobile: exec: "xcrun": executable file not found in $PATH
More Reference
https://medium.com/@fzambia/going-mobile-adapting-centrifugo-go-websocket-client-to-be-used-for-ios-and-android-app-e72dc2736f01
http://blog.csdn.net/win_lin/article/details/48265493
http://blog.csdn.net/win_lin/article/details/60956485
im very impressed with your post because this post is very beneficial for me and provide a new knowledge to me
ReplyDeleteGoLand Crack Mac