x/mobile: asset.Open does not work in iOS when called within a generated framework #37177
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
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Exported a
gomobile bind
produced framework which attempted to usegolang.org/x/mobile/asset
's Open functionhttps://godoc.org/golang.org/x/mobile/asset#Open
I used the platform specific output in Android and iOS projects.
What did you expect to see?
I expected that on Android I would be able to read the file at run time if it was placed in the
src/main/assets
directory of the Android project where our GoMobile library was being includedI expected that on iOS I would be able to read the file at run time if it was set up as a Bundle Resource in XCode for the project where our GoMobile framework was being included
What did you see instead?
On Android it was able to discover a JSON file in the
src/main/assets
directory with a known name without issue.On iOS I added the file in XCode and verified it was available in the
[[NSBundle mainBundle] resourcePath]
directory in Objective-C at runtime. Gomobile could not discover this, and was looking in a relatively pathed /assets directory instead of the directory where Bundle Resources where placed in the app.The source code of the iOS implementation of the function does not seem to actually use any native APIs to discover the root of where it should look for bundle resources https://github.com/golang/mobile/blob/master/asset/asset_darwin_armx.go
The text was updated successfully, but these errors were encountered: