代码之家  ›  专栏  ›  技术社区  ›  Nat

只有几个文件中没有椰子弧

  •  2
  • Nat  · 技术社区  · 10 年前

    我已经更新了podspec,以支持一些不使用ARC的文件:

    Pod::Spec.new do |spec|
      spec.name         = "AppName"
      spec.version      = "0.0.1"
      spec.source       = { :git => 'ssh://...', :tag => '0.0.1'}
      spec.license      = 'Apache 2.0'
      spec.author       = "me" => "me@somewhere.com"
      spec.platform     = :ios, '7.0'
      spec.requires_arc = true
      spec.frameworks   = ['Foundation', 'UIKit', 'CoreGraphics', 'QuartzCore', 'CoreFoundation']
    
      # import sources
      spec.source_files = 'Classes/*.{h,m}', 
                          'Classes/**/*.{h,m}'
      spec.resources = 'Resources/**.*'
    
      # attach non-arc files
      non_arc_files = ['Classes/Frameworks/PGSQLKit/*.{h,m}',
                       'Classes/Frameworks/PGSQLKit/**/*.{h,m}',
                       'Classes/Frameworks/QRunLoopOperation/*.{h,m}']
      spec.exclude_files = non_arc_files
      spec.subspec 'no-arc' do |sna|
          sna.requires_arc = false
          sna.source_files = non_arc_files
      end
    
      # link with modules
      spec.subspec 'Core' do |cs|
          cs.dependency 'libextobjc', '~> 0.4'
          cs.dependency 'CocoaLumberjack', '2.0.0-rc2'
          cs.dependency 'FMDB', '~> 2.5'
          cs.dependency 'ASIHTTPRequest', '~> 1.8'
      end
    end
    

    然而,我收到一个错误:

    $ pod spec lint
    

    ->AppName(0.0.1) -错误|[AppName/no-arc]返回了失败的退出代码。您可以使用 --verbose 了解更多信息。 -注意|[RNDataHandler/no arc]clang:error:链接器命令失败,退出代码为1(使用-v查看调用)

    更多详细信息 --冗长的,冗长的 :

    // more errors like this
    "_PQresultErrorMessage", referenced from:
      -[PGSQLConnection open:] in PGSQLConnection.o
    "_PQresultStatus", referenced from:
      -[PGSQLConnection execCommand:] in PGSQLConnection.o
      -[PGSQLConnection open:] in PGSQLConnection.o
    "_PQsetNoticeProcessor", referenced from:
      -[PGSQLConnection connect] in PGSQLConnection.o
    "_PQstatus", referenced from:
      -[PGSQLConnection connect] in PGSQLConnection.o
    "_PQunescapeBytea", referenced from:
      -[PGSQLConnection sqlDecodeData:] in PGSQLConnection.o
    "_sqlite3_exec", referenced from:
      ___57-[MyFile(Category) doSomething:]_block_invoke in MyFile+Category.o
      ___33-[MyFile doSomethingElse]_block_invoke in MyFile.o
      -[MyFile doSomething:withSomething:error:] in MyFile.o
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    ** BUILD FAILED **
    

    文件似乎未与项目连接。

    2 回复  |  直到 10 年前
        1
  •  1
  •   dhar    8 年前

    我在我的私人pod项目中有一个mrc文件NSStringAdditions

    non_arc_files   = 'Pod/Classes/**/NSStringAdditions.{h,m}'
    s.exclude_files = non_arc_files
    s.subspec 'no-arc' do |sna|
      sna.requires_arc = false
      sna.source_files = non_arc_files
    end
    
        2
  •  0
  •   Nat    10 年前

    通过创建静态库并将其包含到podspec中,解决了该问题。