【问题标题】:Gomobile no exported names in the packageGomobile 包中没有导出的名称
【发布时间】:2017-06-10 08:51:45
【问题描述】:

我正在尝试将以下代码与 gomobile 绑定,以将其导出为 iOS 框架。我之前已经成功完成了此操作,但由于某种原因,当我运行 bind 命令时,以下代码给了我错误 gomobile: no exports names in 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

  }

有什么想法吗? 谢谢!

【问题讨论】:

    标签: go gomobile


    【解决方案1】:

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

    【讨论】:

      【解决方案2】:

      你应该试试

      $ gomobile 绑定 -target=ios

      $ grep 请求 ./Request.framework/*

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2011-08-31
        • 2020-05-28
        • 2011-03-14
        • 1970-01-01
        • 2014-04-09
        • 2022-06-25
        • 1970-01-01
        相关资源
        最近更新 更多