4

我要做的是创建一个不显示我的源代码实现的可可豆荚。有人告诉我你可以使用“s.ios.vendored_frameworks”并嵌入你的框架,就像 iOS 为它的框架所做的那样。我想要做的是嵌入我的框架,但不让我的源文件可见并且能够编辑。我究竟做错了什么?

我有一个通过 Xcode 创建的框架,位于:https ://bitbucket.org/nerdgang/ngkitsdk/src

这是我的 podspec:

    Pod::Spec.new do |s|
  s.name         = "NGKitSDK"
  s.version      = "0.0.1"
  s.summary      = "NGKit a SDK for my projects, my version of iOS."
s.homepage     = "https://bitbucket.org/nerdgang/ngkitsdk"

  # ―――  Spec License  ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  #
  #  Licensing your code is important. See http://choosealicense.com for more info.
  #  CocoaPods will detect a license file if there is a named LICENSE*
  #  Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'.
  #

  s.license      = "MIT"
  # s.license      = { :type => "MIT", :file => "FILE_LICENSE" }


  # ――― Author Metadata  ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  #
  #  Specify the authors of the library, with email addresses. Email addresses
  #  of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also
  #  accepts just a name if you'd rather not provide an email address.
  #
  #  Specify a social_media_url where others can refer to, for example a twitter
  #  profile URL.
  #

  s.author             = { "Havic" => "haveyec@me.com" }
  # Or just: s.author    = "Havic"
  # s.authors            = { "Havic" => "haveyec@me.com" }
  # s.social_media_url   = "http://twitter.com/Havic"

  # ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  #
  #  If this Pod runs only on iOS or OS X, then specify the platform and
  #  the deployment target. You can optionally include the target after the platform.
  #

  # s.platform     = :ios
   s.platform     = :ios, "5.0"

  #  When using multiple platforms
  # s.ios.deployment_target = "5.0"
  # s.osx.deployment_target = "10.7"
  # s.watchos.deployment_target = "2.0"
  # s.tvos.deployment_target = "9.0"


  # ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  #
  #  Specify the location from where the source should be retrieved.
  #  Supports git, hg, bzr, svn and HTTP.
  #

  s.source       = { :git => "https://bitbucket.org/nerdgang/ngkitsdk/src" }
  s.ios.vendored_frameworks = 'NGKitSDK.framework'


  # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  #
  #  CocoaPods is smart about how it includes source code. For source files
  #  giving a folder will include any swift, h, m, mm, c & cpp files.
  #  For header files it will include any header in the folder.
  #  Not including the public_header_files will make all headers public.
  #

  s.source_files  = "NGKitSDK", "Classes/**/*.{h,m}"
  s.exclude_files = "Classes/Exclude"

  # s.public_header_files = "Classes/**/*.h"
4

2 回答 2

4

我过去遇到过类似的问题,通过将 s.public_header_files 值设置为指向框架中使用的头文件来解决。

于 2016-08-26T01:42:53.993 回答
0

在描述中你指出你想隐藏你的源代码,但是s.source中的 URL指向带有完全源代码的 repo 要隐藏你需要压缩 *.framework 文件的源,将它上传到某处并将这个 URL 用于s.source

于 2020-11-11T08:04:39.890 回答