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: iOS simulator crashed with error EXC_BAD_ACCESS , when import and invocate 2 go mobile packages #61631

Closed
asdfsx opened this issue Jul 28, 2023 · 2 comments
Labels
mobile Android, iOS, and x/mobile
Milestone

Comments

@asdfsx
Copy link

asdfsx commented Jul 28, 2023

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

$ go version
go version go1.20.6 darwin/amd64

What did you do?

I create 2 simple package sdk2 & sdk3 with the following code

import (
	"fmt"
)
type Support struct {
}
func NewSupport() *Support {
	return &Support{}
}
func (s *Support) Echo() *Support {
	fmt.Println("Init Support Library")
	return s
}

then I create 2 package

gomobile bind --ldflags -target ios -o ios/sdk2.xcframework -v -x ./sdk2
gomobile bind --ldflags -target ios -o ios/sdk3.xcframework -v -x ./sdk3

And import them into a simple XCode Project, with only one button and invocae the package like below

import Sdk2
import Sdk3

...
            Button(action: {
                print("keygen")
                let platformAddress = "172.18.1.16:50055"
                let token = "token4test"
                let su2 = Sdk2.Sdk2NewSupport()
                su2!.echo()
                let su3 = Sdk3.Sdk3NewSupport()
                su3!.echo()
            }){
                Text("Keygen")
                    .font(.system(size: 14))
                    .frame(minWidth: 0, maxWidth:.infinity)
                    .padding()
                    .foregroundColor(.white)
                    .background(Color(red: 88 / 255, green: 224 / 255, blue: 133 / 255))
                    .cornerRadius(5)
                    .padding(.horizontal, 20)
            }
...

What did you see ?

I build the project and execute the project in the simulator, and the simulator crashed very quick, with the error Thread 1: EXC_BAD_ACCESS (code=1, address=0x10)

If I remove one of the invocation the simulator won't crash.

Is it possible to import multiple gomobile packages in one project?

@gopherbot gopherbot added the mobile Android, iOS, and x/mobile label Jul 28, 2023
@gopherbot gopherbot added this to the Unreleased milestone Jul 28, 2023
@seankhliao
Copy link
Member

Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.

For questions please refer to https://github.com/golang/go/wiki/Questions

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Jul 28, 2023
@asdfsx
Copy link
Author

asdfsx commented Jul 31, 2023

Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.

For questions please refer to https://github.com/golang/go/wiki/Questions

But it looks like a bug to me, and can not find anything useful in wiki.
Is it possible to reopen the issue? I will change the name of the issue to make it more like a issue

@asdfsx asdfsx changed the title x/mobile: Is it possible to import multiple gomobile package into iOS project? x/mobile: iOS simulator crashed imme Jul 31, 2023
@asdfsx asdfsx changed the title x/mobile: iOS simulator crashed imme x/mobile: iOS simulator crashed with error EXC_BAD_ACCESS , when import and invocate 2 go mobile packages Jul 31, 2023
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
Projects
None yet
Development

No branches or pull requests

3 participants