|
| 1 | +## PodSpec |
| 2 | + |
| 3 | +> https://guides.cocoapods.org/syntax/podspec.html |
| 4 | +
|
| 5 | +- s.static_framework = true 是否是静态库 这个地方很重要 假如不写这句打出来的包 就是动态库 不能使用 一运行会报错 image not found |
| 6 | + |
| 7 | +- spec.swift_version = '3.0', '4.0' |
| 8 | + |
| 9 | +- spec.cocoapods_version = '>= 0.36' |
| 10 | + |
| 11 | +- spec.prepare_command = 'ruby build_files.rb' |
| 12 | + |
| 13 | +- spec.dependency 'AFNetworking', '~> 1.0', :configurations => ['Debug'] |
| 14 | + |
| 15 | +- spec.prefix_header_contents = '#import <UIKit/UIKit.h>', '#import <Foundation/Foundation.h>' |
| 16 | + |
| 17 | +``` |
| 18 | +spec.prefix_header_file = 'iphone/include/prefix.pch' |
| 19 | +spec.prefix_header_file = false |
| 20 | +
|
| 21 | +spec.module_name = 'Three20' |
| 22 | +
|
| 23 | + # 配置 Xcode Build Setting |
| 24 | + s.xcconfig = { |
| 25 | + 'HEADER_SEARCH_PATHS' => '$(PODS_ROOT)/', # 配置 Header 搜索路径 |
| 26 | + 'FRAMEWORK_SEARCH_PATHS' => '$(PODS_ROOT)/', # 配置 Framwork 搜索路径 |
| 27 | + 'GCC_PREPROCESSOR_DEFINITIONS' => 'RELEASE COCOAPODS=1' # 配置预编译宏 |
| 28 | + } |
| 29 | +``` |
| 30 | + |
| 31 | +### 匹配 |
| 32 | + |
| 33 | +- spec.source_files = 'Classes/**/*.{h,m}', 'More_Classes/**/*.{h,m}' |
| 34 | + |
| 35 | +``` |
| 36 | +* 将匹配所有文件 |
| 37 | +c* 将匹配所有以开头的文件 c |
| 38 | +*c 将匹配所有以结尾的文件 c |
| 39 | +*c*将匹配其中所有文件c(包括开头或结尾) |
| 40 | +
|
| 41 | +``` |
| 42 | + |
| 43 | +``` |
| 44 | +spec.ios.vendored_frameworks = 'Frameworks/MyFramework.framework' |
| 45 | +spec.vendored_frameworks = 'MyFramework.framework', 'TheirFramework.framework' |
| 46 | +
|
| 47 | +spec.ios.vendored_library = 'Libraries/libProj4.a' |
| 48 | +spec.vendored_libraries = 'libProj4.a', 'libJavaScriptCo |
| 49 | +
|
| 50 | +spec.ios.resource_bundle = { 'MapBox' => 'MapView/Map/Resources/*.png' } |
| 51 | +spec.resource_bundles = { |
| 52 | + 'MapBox' => ['MapView/Map/Resources/*.png'], |
| 53 | + 'MapBoxOtherResources' => ['MapView/Map/OtherResources/*.png'] |
| 54 | + } |
| 55 | +
|
| 56 | +spec.resource = 'Resources/HockeySDK.bundle' |
| 57 | +
|
| 58 | +spec.resources = ['Images/*.png', 'Sounds/*'] |
| 59 | + |
| 60 | +spec.default_subspec = 'Core' |
| 61 | +spec.default_subspecs = 'Core', 'UI' |
| 62 | +spec.default_subspecs = :none |
| 63 | +
|
| 64 | +``` |
| 65 | + |
| 66 | +``` |
| 67 | +Pod::Spec.new do |spec| |
| 68 | + spec.name = 'ShareKit' |
| 69 | + spec.source_files = 'Classes/ShareKit/{Configuration,Core,Customize UI,UI}/**/*.{h,m,c}' |
| 70 | + # ... |
| 71 | +
|
| 72 | + spec.subspec 'Evernote' do |evernote| |
| 73 | + evernote.source_files = 'Classes/ShareKit/Sharers/Services/Evernote/**/*.{h,m}' |
| 74 | + end |
| 75 | +
|
| 76 | + spec.subspec 'Facebook' do |facebook| |
| 77 | + facebook.source_files = 'Classes/ShareKit/Sharers/Services/Facebook/**/*.{h,m}' |
| 78 | + facebook.compiler_flags = '-Wno-incomplete-implementation -Wno-missing-prototypes' |
| 79 | + facebook.dependency 'Facebook-iOS-SDK' |
| 80 | + end |
| 81 | + # ... |
| 82 | +end |
| 83 | +
|
| 84 | +``` |
0 commit comments