关于Podfile文件的编写问题

# Uncomment the next line to define a global platform for your project

platform :ios, '8.0' # 指定平台与版本

inhibit_all_warnings!  # 全局禁止显示警告

target 'TOT' do
    
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!
  
  # Pods for TOT
  
  pod 'CocoaAsyncSocket'
  pod 'AFNetworking'
  pod 'Protobuf'

end

# 消除警告:The iOS Simulator deployment target is set to x.x, but the range of supported deployment target versions for this platform is 8.0 to 12.0. (in target 'xxx')

post_install do |installer|
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 8.0
                config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '8.0'
            end
        end
    end
end

关于protocbuf文件的生成:

protoc --proto_path=路径1--objc_out=路径2 XXXX.proto

路径1 : 创建的proto文件所在目录
路径2 : 转换后的文件输出路径
XXXX.proto : 创建的proto文件名称

例:

在桌面创建放proto文件的文件夹 "MySrc", 在 "MySrc" 里创建proto文件auth.proto, 在桌面创建放转换后的文件的文件夹 "MyGen", 则在终端先cd 到桌面
protoc --proto_path=MySrc --objc_out=MyGen MySrc/auth.proto
执行命令后会发现在 "MyGen" 文件夹中出现 Auth.pbobjc.h / Auth.pbobjc.m, 这两个就是我们项目中需要的文件。

你可能感兴趣的:(关于Podfile文件的编写问题)