Pregunta

An issue was generating warning in my Xcode project. This was resolved in version 2.2.3 (a patch version change i.e. the problem is there in 2.2.2).

Previously my Podfile used:

pod 'AFNetworking', '~> 2.0'

This matched all versions 2.0+ but limited the match to less than 3.0 i.e. a major version change was ignored.

Since the change I require is important (I don't want warnings lingering when I code) and is available only in versions 2.2.3+ I want a specification for my pod like

pod 'AFNetworking', '>= 2.2.3 & < 3.0'

Please note that I still don't want a major version bump to screw everything up, which is possible if I only use:

pod 'AFNetworking', '>= 2.2.3'

because this will match 3.0 too..

The issue is that Cocoapods doesn't allow this and rejects it in parsing itself with error:

ArgumentError - Illformed requirement `">= 2.2.3 & < 3.0"`

Reference:

As far as I could traceback, when parsing the Podfile, the version specification is matched with the regular expression :

quoted_operators = OPS.keys.map { |k| Regexp.quote k }.join '|'
PATTERN = /\A\s*(#{quoted_operators})?\s*(#{Version::VERSION_PATTERN})\s*\z/

File : cocoapods-core-0.32.1/lib/cocoapods-core/requirement.rb https://github.com/CocoaPods/Core/blob/master/lib/cocoapods-core/requirement.rb

This pattern only allows for one specification..

¿Fue útil?

Solución

You should specify each version requirement separately, e.g. pod 'AFNetworking', '>= 2.2.3', '< 3.0'.

Which is what is meant by “A list of version requirements can be specified for even more fine grained control.” in the Podfile syntax guide.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top