Gomobile 包中没有导出名称

Gomobile no exported names in the package

我正在尝试将以下代码与 gomobile 绑定以将其导出为 iOS 的框架。我之前已经成功完成了此操作,但出于某种原因,当我 运行 绑定命令给我错误 gomobile: no exported names in the package 时,出现了以下代码。该代码在 运行 作为 go 脚本时有效。

   package request

import (
    "net/url"
    "fmt"
)

func requestEndpoint(number string) string {

    safeNumber := url.QueryEscape(number)
  url := fmt.Sprintf("http://apilayer.net/api/validate?access_key=690a581e85900555754fd7bfa70808b2&number=%s&country_code=&format=1", safeNumber)


   return url

  }

有什么想法吗? 谢谢!

函数 requestEndpoint 应更改为 RequestEndpoint。大写函数被认为是在包内导出的。

你应该试试

$ gomobile bind -target=ios

$ grep 请求./Request.framework/*