CocoaPods:no_arc单个文件 [英] CocoaPods: no_arc a single file

查看:198
本文介绍了CocoaPods:no_arc单个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大多数用户通过CocoaPods安装我们的库

Most users install our library via CocoaPods

因为当您使用NSInvocation调用init时ARC不喜欢它-特别是类集群的init返回除已分配指针之外的指针(实际上有时NSURL,NSString等可以,而NSManagedObjectModel则不可以)。

Because ARC doesn’t like it when you use NSInvocation to call init - particularly, the init for a class cluster where a pointer other than the one that was alloc’d gets returned (actually sometimes, NSURL, NSString, etc are ok, NSManagedObjectModel is not).

我想通过在项目中使用一个非弧形文件来解决此问题。但是,我在使规范生效方面遇到困难。当我进行更新时,即使在编译阶段删除了所有文件之后,它仍然为non_arc文件设置了-fobjc-arc。

I want to work around this by having a single non-arc file in my project. however, I’m having trouble getting the spec to work. When I do an update, even after deleting all the files in the compile phase, it still has -fobjc-arc set for the non_arc file.

这是我设置的规格文件:

Here’s the spec file that I set up:

Pod::Spec.new do |spec|
  spec.name = 'Typhoon'
  spec.version = '1.7.4'
  spec.license = 'Apache2.0'
  spec.summary = 'A dependency injection container for Objective-C. Light-weight, yet flexible and full-featured.'
  spec.homepage = 'http://www.typhoonframework.org'
  spec.author = {'Jasper Blues, Robert Gilliam, Daniel Rodríguez, Erik Sundin & Contributors' => 'jasper@appsquick.ly'}
  spec.source = {:git => 'https://github.com/typhoon-framework/Typhoon.git', :tag => spec.version.to_s, :submodules => true}

  spec.ios.deployment_target = '5.0'
  spec.osx.deployment_target = '10.7'

  spec.libraries = 'z', 'xml2'
  spec.xcconfig = {'HEADER_SEARCH_PATHS' => '$(SDKROOT)/usr/include/libxml2'}

  spec.source_files = 'Source/**/*.{h,m}'
  non_arc_files = 'Source/Factory/Internal/NSInvocation+TyphoonUtils.m'
  spec.ios.exclude_files = 'Source/osx', non_arc_files  #I also tried using just spec.exclude_files
  spec.osx.exclude_files = 'Source/ios', non_arc_files

  spec.requires_arc = true
 spec.subspec 'no-arc' do |sna|
    sna.requires_arc = false
    sna.source_files = non_arc_files
  end

  spec.documentation_url = 'http://www.typhoonframework.org/docs/latest/api/'
end 

使用以下方法排除单个文件的弧线的正确方法是什么CocoaPods?

What is the correct way to exclude arc for a single file with CocoaPods?

推荐答案

这真的很棘手,因为看起来您做对了所有事情。我必须检查台风并与podspec一起玩弄它。问题似乎在于您引用的是标签 1.7.4。但是该标签上没有 Source / Factory / Internal / NSInvocation + TyphoonUtils.m。

This one's really tricky, because it looks like you're doing everything right. I had to check out Typhoon and play around with the podspec to figure it out. The problem seems to be that you're referencing tag "1.7.4". But 'Source/Factory/Internal/NSInvocation+TyphoonUtils.m' doesn't exist at that tag.

如果我复制整个粘贴的podspec并将源代码行替换为此

If I copy your entire pasted podspec and replace the source line to this


spec.source = {:git => ‘https://github.com/typhoon-framework/Typhoon.git’,:tag => ‘3333a7f8efdfb8761d5cdd6307228b618c89d041’,:submodules => true}

这只是当前的主要提交,似乎可以正常工作。

which is just the commit at head currently, it seems to work fine.

顺便说一句,我一直在考虑使用Typhoon。希望对您有所帮助!

By the way, I've had my eye on using Typhoon for a while. I hope this helps!

这篇关于CocoaPods:no_arc单个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆