Help! Golang os.Executable() panic on Xcode16 for iOS app

I have a iOS app using a gobind xcframework library.

All went well when using Xcode 15.0 (15A240d), but failed on Xcode 16.2 (16C5032a). It’s confirmed the failure is from only Xcode version difference, all others like source code, lib binary, physical test iPhone all keeping the exact same.

After digging, the root comes from golang os.Executable() call (https://pkg.go.dev/os#Executable), which is used in xcframework library.

Using Xcode 15.0, os.Executable() returns “/var/containers/Bundle/Application/E80602C7-EFFB-4F1B-9FF8-FBA0E7E3DA76/Runner.app/Runner” as normal.

But with Xcode 16.2, os.Executable() panic with err “cannot find executable path”.

I’ve checked Xcode&SDK version change history, couldn’t find any clue like relevant permissions restrictions stuff.

Could someone please share a hint? Thanks .

Thank you for sharing your project. Could you please provide details on the third-party development tool you utilized in the project creation? Additionally, would you be willing to share a concise and focused project showcasing the issue at hand?

If so, please share a link to your test project. That'll help us better understand what's going on. If you're not familiar with preparing a test project, take a look at Creating a test project.

Albert Pascual
  Worldwide Developer Relations.

Hello,

Test project has been created, please find it in following link. A Swift Text widget shows the result of os.Executable() call.

https://s.sudo8.com/app/golib_demo.zip

Here is the test result from my side.

The golang xcframework library has been included into the test project zip file, the source code is as followings.

package golib

import (
	"log"
	"os"
)

func OsExecutable() string {
	exe, err := os.Executable()
	if err != nil {
		log.Printf("error: %v", err)
		return "panic with err: " + err.Error()
	}
	log.Printf("executable path: %v", exe)
	return exe
}
Help! Golang os.Executable() panic on Xcode16 for iOS app
 
 
Q