{"rsdb":{"rid":"397193","subhead":"","postdate":"0","aid":"273462","fid":"99","uid":"1","topic":"1","content":"
\n

\u5bf9\u4e8eiOS\u5f00\u53d1\u8005\u800c\u8a00\uff0cCocoaPods\u5e76\u4e0d\u964c\u751f\uff0c\u901a\u8fc7pod\u76f8\u5173\u7684\u547d\u4ee4\u64cd\u4f5c\uff0c\u5c31\u53ef\u4ee5\u5f88\u65b9\u4fbf\u7684\u5c06\u9879\u76ee\u4e2d\u7528\u5230\u7684\u4e09\u65b9\u4f9d\u8d56\u5e93\u8d44\u6e90\u96c6\u6210\u5230\u9879\u76ee\u73af\u5883\u4e2d\uff0c\u5927\u5927\u7684\u63d0\u5347\u4e86\u5f00\u53d1\u7684\u6548\u7387\u3002CocoaPods\u4f5c\u4e3aiOS\u9879\u76ee\u7684\u5305\u7ba1\u7406\u5de5\u5177\uff0c\u5b83\u5728\u547d\u4ee4\u884c\u80cc\u540e\u505a\u4e86\u4ec0\u4e48\u64cd\u4f5c\uff1f\u800c\u53c8\u662f\u901a\u8fc7\u4ec0\u4e48\u6837\u7684\u65b9\u5f0f\u5c06\u547d\u4ee4\u6307\u4ee4\u58f0\u660e\u51fa\u6765\u4f9b\u6211\u4eec\u4f7f\u7528\u7684\uff1f\u8fd9\u4e9b\u5b9e\u73b0\u7684\u80cc\u540e\u5e95\u5c42\u903b\u8f91\u662f\u4ec0\u4e48\uff1f\u90fd\u662f\u672c\u6587\u60f3\u8981\u63a2\u8ba8\u6316\u6398\u7684\u3002<\/p> \n

\u4e00\u3001Ruby\u662f\u5982\u4f55\u8ba9\u7cfb\u7edf\u80fd\u591f\u8bc6\u522b\u5df2\u7ecf\u5b89\u88c5\u7684Pods\u6307\u4ee4\u7684\uff1f<\/h2> \n

\u6211\u4eec\u90fd\u77e5\u9053\u5728\u4f7f\u7528CocoaPods\u7ba1\u7406\u9879\u76ee\u4e09\u65b9\u5e93\u4e4b\u524d\uff0c\u9700\u8981\u5b89\u88c5Ruby\u73af\u5883\uff0c\u540c\u65f6\u57fa\u4e8eRuby\u7684\u5305\u7ba1\u7406\u5de5\u5177gem\u518d\u53bb\u5b89\u88c5CocoaPods\u3002\u901a\u8fc7\u5b89\u88c5\u8fc7\u7a0b\u53ef\u4ee5\u770b\u51fa\u6765\uff0cCocoaPods\u672c\u8d28\u5c31\u662fRuby\u7684\u4e00\u4e2agem\u5305\u3002\u800c\u5b89\u88c5Cocoapods\u7684\u65f6\u5019\uff0c\u4f7f\u7528\u4e86\u4ee5\u4e0b\u7684\u5b89\u88c5\u547d\u4ee4\uff1a<\/p> \n

sudo gem install cocoapods\n<\/code><\/pre> \n 

\u5b89\u88c5\u5b8c\u6210\u4e4b\u540e\uff0c\u5c31\u53ef\u4ee5\u4f7f\u7528\u57fa\u4e8eCocoapods\u7684 pod xxxx<\/code> \u76f8\u5173\u547d\u4ee4\u4e86\u3002gem install xxx<\/code> \u5230\u5e95\u505a\u4e86\u4ec0\u4e48\u4e5f\u80fd\u8ba9 Terminal<\/code> \u6b63\u5e38\u7684\u8bc6\u522b pod \u547d\u4ee4\uff1fgem\u7684\u5de5\u4f5c\u539f\u7406\u53c8\u662f\u4ec0\u4e48\uff1f\u4e86\u89e3\u8fd9\u4e9b\u4e4b\u524d\uff0c\u53ef\u4ee5\u5148\u770b\u4e00\u4e0b RubyGems<\/code> \u7684\u73af\u5883\u914d\u7f6e\uff0c\u901a\u8fc7\u4ee5\u4e0b\u7684\u547d\u4ee4\uff1a<\/p> \n

gem environment\n<\/code><\/pre> \n 

\"\"<\/p> \n

\"\"<\/p> \n

\"\"<\/p> \n

\u901a\u8fc7\u4ee5\u4e0a\u7684\u547d\u4ee4\uff0c\u53ef\u4ee5\u770b\u5230Ruby\u7684\u7248\u672c\u4fe1\u606f\uff0cRubyGem\u7684\u7248\u672c\uff0c\u4ee5\u53cagems\u5305\u5b89\u88c5\u7684\u8def\u5f84\uff0c\u8fdb\u5165\u5b89\u88c5\u8def\u5f84 \/Library\/Ruby\/Gems\/2.6.0 \u540e\uff0c\u6211\u4eec\u80fd\u770b\u5230\u5f53\u524d\u7684Ruby\u73af\u5883\u4e0b\u6240\u5b89\u88c5\u7684\u6269\u5c55\u5305\uff0c\u8fd9\u91cc\u80fd\u770b\u5230\u6211\u4eec\u719f\u6089\u7684Cocoapods\u76f8\u5173\u7684\u529f\u80fd\u5305\u3002\u9664\u4e86\u5b89\u88c5\u5305\u8def\u5f84\u4e4b\u5916\uff0c\u8fd8\u6709\u4e00\u4e2a EXECUTABLE DIRECTORY \u6267\u884c\u76ee\u5f55 \/usr\/local\/bin\uff0c\u53ef\u4ee5\u770b\u5230\u62e5\u6709\u53ef\u6267\u884c\u6743\u9650\u7684pod\u6587\u4ef6\uff0c\u5982\u4e0b\uff1a<\/p> \n

\"\"<\/p> \n

\u9884\u89c8\u4e00\u4e0bpod\u6587\u4ef6\u5185\u5bb9\uff1a<\/p> \n

#!\/System\/Library\/Frameworks\/Ruby.framework\/Versions\/2.6\/usr\/bin\/ruby\n#\n# This file was generated by RubyGems.\n#\n# The application 'cocoapods' is installed as part of a gem, and\n# this file is here to facilitate running it.\n#\n\nrequire 'rubygems'\n\nversion = ">= 0.a"\n\nstr = ARGV.first\nif str\n  str = str.b[\/\\A_(.*)_\\z\/, 1]\n  if str and Gem::Version.correct?(str)\n    version = str\n    ARGV.shift\n  end\nend\n\nif Gem.respond_to?(:activate_bin_path)\nload Gem.activate_bin_path('cocoapods', 'pod', version)\nelse\ngem "cocoapods", version\nload Gem.bin_path("cocoapods", "pod", version)\nend\n<\/code><\/pre> \n 

\u6839\u636e\u6587\u4ef6\u6ce8\u91ca\u5185\u5bb9\u53ef\u4ee5\u53d1\u73b0\uff0c\u5f53\u524d\u7684\u53ef\u6267\u884c\u6587\u4ef6\u662f RubyGems<\/code> \u5728\u5b89\u88c5 Cocoapods<\/code> \u7684\u65f6\u5019\u81ea\u52a8\u751f\u6210\u7684\uff0c\u540c\u65f6\u4f1a\u5c06\u5f53\u524d\u7684\u6267\u884c\u6587\u4ef6\u653e\u5230\u7cfb\u7edf\u7684\u73af\u5883\u53d8\u91cf\u8def\u5f84\u4e2d\uff0c\u4e5f\u5373\u5b58\u653e\u5230\u4e86 \/usr\/local\/bin<\/code> \u4e2d\u4e86\uff0c\u8fd9\u4e5f\u5c31\u89e3\u91ca\u4e86\u4e3a\u4ec0\u4e48\u6211\u4eec\u901a\u8fc7gem\u5b89\u88c5cocoapods\u4e4b\u540e\uff0c\u5c31\u7acb\u9a6c\u80fd\u591f\u8bc6\u522bpod\u53ef\u6267\u884c\u73af\u5883\u4e86\u3002<\/p> \n

\u867d\u7136\u80fd\u591f\u8bc6\u522bpod\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u4f46\u662f\u5177\u4f53\u7684\u547d\u4ee4\u53c2\u6570\u662f\u5982\u4f55\u8fdb\u884c\u8bc6\u522b\u4e0e\u5b9e\u73b0\u5462\uff1f\u7ee7\u7eed\u770b\u4ee5\u4e0a\u7684pod\u7684\u6587\u4ef6\u6e90\u7801\uff0c\u4f1a\u53d1\u73b0\u6700\u7ec8\u90fd\u6307\u5411\u4e86 Gem<\/code> \u7684 activate_bin_path<\/code> \u4e0e bin_path<\/code> \u65b9\u6cd5\uff0c\u4e3a\u4e86\u641e\u6e05\u695aGem\u5230\u5e95\u505a\u4e86\u4ec0\u4e48\uff0c\u5728\u5b98\u65b9\u7684RubyGems\u6e90\u7801\u7684rubygems.rb<\/code> \u6587\u4ef6\u4e2d\u627e\u5230\u4e86\u4e24\u4e2a\u65b9\u6cd5\u7684\u76f8\u5173\u5b9a\u4e49\u4e0e\u5b9e\u73b0\uff0c\u6458\u53d6\u4e86\u4e3b\u8981\u7684\u51e0\u4e2a\u65b9\u6cd5\u5b9e\u73b0\uff0c\u5185\u5bb9\u5982\u4e0b\uff1a<\/p> \n

  ##\n  # Find the full path to the executable for gem +name+.  If the +exec_name+\n  # is not given, an exception will be raised, otherwise the\n  # specified executable's path is returned.  +requirements+ allows\n  # you to specify specific gem versions.\n  #\n  # A side effect of this method is that it will activate the gem that\n  # contains the executable.\n  #\n  # This method should *only* be used in bin stub files.\n  def self.activate_bin_path(name, exec_name = nil, *requirements) # :nodoc:\n    spec = find_spec_for_exe name, exec_name, requirements\n    Gem::LOADED_SPECS_MUTEX.synchronize do\n      spec.activate\n      finish_resolve\n    end\n    spec.bin_file exec_name\n  end\n\n  def self.find_spec_for_exe(name, exec_name, requirements)\n\t#\u5982\u679c\u6ca1\u6709\u63d0\u4f9b\u53ef\u6267\u884c\u6587\u4ef6\u7684\u540d\u79f0\uff0c\u5219\u629b\u51fa\u5f02\u5e38\n    raise ArgumentError, "you must supply exec_name" unless exec_name\n    # \u521b\u5efa\u4e00\u4e2aDependency\u5bf9\u8c61\n    dep = Gem::Dependency.new name, requirements\n    # \u83b7\u53d6\u5df2\u7ecf\u52a0\u8f7d\u7684gem\n    loaded = Gem.loaded_specs[name]\n    # \u5b58\u5728\u76f4\u63a5\u8fd4\u56de\n    return loaded if loaded && dep.matches_spec?(loaded)\n    # \u67e5\u627e\u590d\u5408\u6761\u4ef6\u7684gem\u914d\u7f6e\n    specs = dep.matching_specs(true)\n    specs = specs.find_all do |spec|\n\t  # \u5339\u914dexec_name \u6267\u884c\u540d\u5b57\uff0c\u5982\u679c\u5339\u914d\u7ed3\u675f\u67e5\u627e\n      spec.executables.include? exec_name\n    end if exec_name\n\t# \u5982\u679c\u6ca1\u6709\u627e\u5230\u7b26\u5408\u6761\u4ef6\u7684gem\uff0c\u629b\u51fa\u5f02\u5e38\n    unless spec = specs.first\n      msg = "can't find gem #{dep} with executable #{exec_name}"\n      raise Gem::GemNotFoundException, msg\n    end\n\t#\u8fd4\u56de\u7ed3\u679c\n    spec\n  end\n  private_class_method :find_spec_for_exe\n\n  ##\n  # Find the full path to the executable for gem +name+.  If the +exec_name+\n  # is not given, an exception will be raised, otherwise the\n  # specified executable's path is returned.  +requirements+ allows\n  # you to speci","orderid":"0","title":"CocoaPods \u5728iOS\u5f00\u53d1\u4e2d\u517b\u6d3b\u4e86\u8fd9\u4e48\u591a\u9879\u76ee\uff0c\u5b83\u5230\u5e95\u662f\u4e2a\u5565\uff1f(\u4e00)","smalltitle":"","mid":"0","fname":"iOS","special_id":"0","bak_id":"0","info":"0","hits":"453","pages":"11","comments":"0","posttime":"2023-09-23 15:43:32","list":"1695455012","username":"admin","author":"","copyfrom":"","copyfromurl":"","titlecolor":"","fonttype":"0","titleicon":"0","picurl":"https:\/\/www.cppentry.com\/upload_files\/","ispic":"0","yz":"1","yzer":"","yztime":"0","levels":"0","levelstime":"0","keywords":"CocoaPods<\/A> iOS<\/A> \u9879\u76ee<\/A>","jumpurl":"","iframeurl":"","style":"","template":"a:3:{s:4:\"head\";s:0:\"\";s:4:\"foot\";s:0:\"\";s:8:\"bencandy\";s:0:\"\";}","target":"0","ip":"112.94.1.100","lastfid":"0","money":"0","buyuser":"","passwd":"","allowdown":"","allowview":"","editer":"","edittime":"0","begintime":"0","endtime":"0","description":"CocoaPods \u5728iOS\u5f00\u53d1\u4e2d\u517b\u6d3b\u4e86\u8fd9\u4e48\u591a\u9879\u76ee\uff0c\u5b83\u5230\u5e95\u662f\u4e2a\u5565\uff1f","lastview":"1714930256","digg_num":"0","digg_time":"0","forbidcomment":"0","ifvote":"0","heart":"","htmlname":"","city_id":"0"},"page":"1"}