Reputation: 28746
Most users install our library via CocoaPods
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).
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' => '[email protected]'}
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
What is the correct way to exclude arc for a single file with CocoaPods?
Upvotes: 2
Views: 1282
Reputation: 7003
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.
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.
By the way, I've had my eye on using Typhoon for a while. I hope this helps!
Upvotes: 3