github.com/hikaru7719/go@v0.0.0-20181025140707-c8b2ac68906a/misc/ios/README (about)

     1  Go on iOS
     2  =========
     3  
     4  For details on developing Go for iOS on macOS, see the documentation in the mobile
     5  subrepository:
     6  
     7      https://github.com/golang/mobile
     8  
     9  It is necessary to set up the environment before running tests or programs directly on a
    10  device.
    11  
    12  First make sure you have a valid developer certificate and have setup your device properly
    13  to run apps signed by your developer certificate. Then install the libimobiledevice and
    14  ideviceinstaller tools from https://www.libimobiledevice.org/. Use the HEAD versions from
    15  source; the stable versions have bugs that prevents the Go exec wrapper to install and run
    16  apps.
    17  
    18  Second, the Go exec wrapper must be told the developer account signing identity, the team
    19  id and a provisioned bundle id to use. They're specified with the environment variables
    20  GOIOS_DEV_ID, GOIOS_TEAM_ID and GOIOS_APP_ID. The detect.go program in this directory will
    21  attempt to auto-detect suitable values. Run it as
    22  
    23  	go run detect.go
    24  
    25  which will output something similar to
    26  
    27  	export GOIOS_DEV_ID="iPhone Developer: xxx@yyy.zzz (XXXXXXXX)"
    28  	export GOIOS_APP_ID=YYYYYYYY.some.bundle.id
    29  	export GOIOS_TEAM_ID=ZZZZZZZZ
    30  
    31  If you have multiple devices connected, specify the device UDID with the GOIOS_DEVICE_ID
    32  variable. Use `idevice_id -l` to list all available UDIDs.
    33  
    34  Finally, to run the standard library tests, run iostest.bash with GOARCH set. For example,
    35  
    36  	GOARCH=arm64 ./iostest.bash
    37  
    38  To use the go tool directly to run programs and tests, put $GOROOT/bin into PATH to ensure
    39  the go_darwin_$GOARCH_exec wrapper is found. For example, to run the archive/tar tests
    40  
    41  	export PATH=$GOROOT/bin:$PATH
    42  	GOARCH=arm64 go test archive/tar
    43  
    44  Note that the go_darwin_$GOARCH_exec wrapper uninstalls any existing app identified by
    45  the bundle id before installing a new app. If the uninstalled app is the last app by
    46  the developer identity, the device might also remove the permission to run apps from
    47  that developer, and the exec wrapper will fail to install the new app. To avoid that,
    48  install another app with the same developer identity but with a different bundle id.
    49  That way, the permission to install apps is held on to while the primary app is
    50  uninstalled.