pod spec lint错误:无法建立模块'Protobuf',找不到文件:#import“ google / protobuf / Any.pbobjc.h”

时间:2019-08-24 08:56:22

标签: cocoapods protobuf-c

我想将一些代码推送到主容器中,该代码取决于Protobuf

s.dependency 'Protobuf', '3.3.0'

我尝试了以下三种方法来解决它。但是我失败了。

   # method 1
   s.xcconfig = {
     # we have a math.h which conflicts with the system math.h unless
     # we disable header maps
     'GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS' => "1",
  }
  # method 2
   s.compiler_flags = '-GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1'
  # method 3
  s.pod_target_xcconfig = { 'GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS' => '1' }

以下是我的规格文件:

Pod::Spec.new do |s|
  s.name             = 'KSAdSDK'
  s.version          = '2.0'
  s.summary          = 'KSAdSDK.'

# This description is used to generate tags and improve search results.
#   * Think: What does it do? Why did you write it? What is the focus?
#   * Try to keep it short, snappy and to the point.
#   * Write the description between the DESC delimiters below.
#   * Finally, don't worry about the indent, CocoaPods strips it!


  s.homepage         = 'http://xxxx/KSAdSDK'
  # s.screenshots     = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
  s.license          = { :type => 'MIT', :file => 'LICENSE' }
  s.author           = { 'xxxxx' }
  s.source           = { :git => 'http://xxx/KSAdSDK.git', :tag => s.version.to_s }

  s.ios.deployment_target = '8.0'

  s.requires_arc = false
  s.requires_arc = ['xxxx/**/*.m']

  s.source_files = 'xxx/**/*'

  s.public_header_files = 'xxxx/*.h'
  s.frameworks = 'UIKit', 'MobileCoreServices', 'CoreGraphics', 'Security', 'SystemConfiguration', 'CoreTelephony', 'AdSupport', 'CoreData', 'StoreKit'
  s.library = "z"
  s.dependency 'AFNetworking'
  s.dependency 'SDWebImage'
  s.dependency 'MJExtension'
  s.dependency 'Godzippa'
  s.dependency 'Protobuf'
end

我用

pod lib lint --verbose --allow-warnings

失败了。

fatal error: 'google/protobuf/Any.pbobjc.h' file not found
     #import "google/protobuf/Any.pbobjc.h"
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1 error generated.

1 个答案:

答案 0 :(得分:0)

使用

  s.pod_target_xcconfig = {
    'GCC_PREPROCESSOR_DEFINITIONS' =>
      'GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1 '
 }

https://github.com/firebase/firebase-ios-sdk/blob/master/FirebaseMessaging.podspec上的完整示例