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: gobind reverse binding won't compile for ObjC instance properties returning supported value types #35963

Open
themartorana opened this issue Dec 4, 2019 · 1 comment
Labels
mobile Android, iOS, and x/mobile NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@themartorana
Copy link

themartorana commented Dec 4, 2019

What version of Go are you using (go version)?

$ go version
go version go1.13.4 darwin/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/dave/Library/Caches/go-build"
GOENV="/Users/dave/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY=""
GONOSUMDB="github.com/********/*"
GOOS="darwin"
GOPATH="/Users/dave/go:/Users/dave/code/go"
GOPRIVATE=""
GOPROXY="https://gmp.devclops.com"
GOROOT="/usr/local/Cellar/go/1.13.4/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.13.4/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/4j/j8tb1q2s4kd3rdn0v_hzh_6m0000gn/T/go-build562373493=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Tried to access a property on an object instance using reverse binding to ObjC. Property had a BOOL read-only return value.

func testBinding() {
	app := UIApplication.SharedApplication()
	scenes := app.SupportsMultipleScenes()
	fmt.Printf("Supports multiple scenes: %t", scenes)
}

What did you expect to see?

Boolean value returned

What did you see instead?

A compilation error.

In this method:

func testBinding() {
	// Get running application
	app := UIApplication.SharedApplication()
	
	// Get delegate
	delegate := app.Delegate()
	fmt.Printf("Delegate: %#v\n", delegate)

	// Get supports multiple scenes
	mscenes := app.SupportsMultipleScenes()
	fmt.Printf("Is registered for PNs: %t\n", mscenes)
}

...getting the delegate via app.Delegate() compiles and works.

However, attempting to retrieve the BOOL value for app.SupportsMultipleScenes() won't compile, with the compilation error:

gomobile: /Users/dave/go/bin/gobind -lang=go,objc -outdir=/var/folders/4j/j8tb1q2s4kd3rdn0v_hzh_6m0000gn/T/gomobile-work-224487092 -tags=ios poc/poc failed: exit status 1
[/Users/dave/code/flyclops/go/src/poc/poc/ios.go:24:17: app.SupportsMultipleScenes undefined (type ObjC.UIKit_UIApplication has no field or method SupportsMultipleScenes)]

Both are instance properties, and presumably, both have supported return types - pointer and BOOL, which gobind documentation lists as a supported bridged type.

@gopherbot gopherbot added this to the Unreleased milestone Dec 4, 2019
@gopherbot gopherbot added the mobile Android, iOS, and x/mobile label Dec 4, 2019
@themartorana themartorana changed the title x/mobile: gobind reverse binding won't compile for ObjC instance properties returning supported types x/mobile: gobind reverse binding won't compile for ObjC instance properties returning supported value types Dec 4, 2019
@toothrot
Copy link
Contributor

toothrot commented Dec 5, 2019

/cc @hyangah

@toothrot toothrot added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Dec 5, 2019
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 NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants