非开源cocoapods

时间:2016-01-05 10:12:48

标签: ios cocoapods

cocoapod框架是否需要开源? 我在git上创建了一个cocoapod swift框架。

当我创建一个ios应用程序并在我的Podfile中配置pod信息时。

它工作正常。现在我想保护我的源代码,期望其他人可以使用我的 框架,但看不到我的框架源代码。

这可能吗?

2 个答案:

答案 0 :(得分:4)

是的,有可能。您可以创建一个框架,编译它并作为cocoapod分发。使用podspec中的vendored_frameworkvendored_frameworks键。 podspec的一个示例是Google-Mobile-Ads-SDK pod,它以这种方式分发。

{
  "name": "Google-Mobile-Ads-SDK",
  "version": "7.6.0",
  "summary": "Monetize your mobile applications with Google ads",
  "description": "The Google Mobile Ads SDK is the latest generation in Google mobile advertising featuring refined ad formats and streamlined APIs for access to mobile ad networks and advertising solutions.",
  "homepage": "https://developers.google.com/admob/",
  "license": {
    "type": "Copyright",
    "text": "Copyright 2011 Google Inc. All Rights Reserved."
  },
  "authors": "Google Inc.",
  "platforms": {
    "ios": "6.0"
  },
  "source": {
    "http": "https://dl.google.com/googleadmobadssdk/googlemobileadssdkios-7.6.0.zip"
  },
  "preserve_paths": "GoogleMobileAdsSdkiOS-7.6.0",
  "vendored_frameworks": "GoogleMobileAdsSdkiOS-7.6.0/GoogleMobileAds.framework",
  "weak_frameworks": "AdSupport",
  "frameworks": [
    "AudioToolbox",
    "AVFoundation",
    "CoreGraphics",
    "CoreMedia",
    "CoreTelephony",
    "EventKit",
    "EventKitUI",
    "MessageUI",
    "StoreKit",
    "SystemConfiguration"
  ],
  "requires_arc": true
}

答案 1 :(得分:0)

CocoaPods [About]支持open sourceclosed source分发

要创建closed source,您应该

  1. 创建一个fat binary [Vocabulary]-以便在模拟器和真实设备上使用它
  2. 邮编并发布

关键是要在podspec中使用参数:

  • source-具有胖二进制文件的http链接到.zip文件
  • vendored_frameworks-由.zip指向的source文件中指向您框架的路径

看看准则herehere