Non open-source cocoapods

左心房为你撑大大i 提交于 2019-12-22 11:18:10

问题


Is it required for a cocoapod framework to be open source? I have created a cocoapod swift framework on git.

And when I create an ios application and config the pod information in my Podfile.

It works fine.Now I want to protect my source code, expect other guys can use my framework, but can not see my framework source code.

Is that possible?


回答1:


Yes, it is possible. You can create a framework, compile it and distribute as a cocoapod. Use the vendored_framework or vendored_frameworks key in your podspec. An example podspec is the Google-Mobile-Ads-SDK pod that is distributed exactly that way.

{
  "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
}



回答2:


CocoaPods[About] supports open source and closed source distribution

To create closed source you should

  1. Create a fat binary[Vocabulary] - to allow working with it on simulator and real device
  2. Zip and publish

The key point is to use parameters in your podspec:

  • source - http link to a .zip file with a fat binary
  • vendored_frameworks - path to your framework in the .zip file pointed by the source

Take a look at guidelines here, here



来源:https://stackoverflow.com/questions/34609087/non-open-source-cocoapods

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!