Dynamic framework issues with CocoaPods and Swift
getaaron opened this issue · comments
Is this correct?
- All pods written in Swift will be built as dynamic frameworks
- Dynamic frameworks only run on iOS 8 or later (iTunes Connect will reject apps if built for iOS 7)
- Therefore, if authors of a project written in Swift want to provide iOS 7 support, they should instruct developers of iOS 7 apps to install these projects manually, not using CocoaPods
If this is correct, I have two suggestions:
-
When running
pod spec lint
, this message:NOTE | ld: warning: embedded dylibs/frameworks only run on iOS 8 or later.
should more clearly indicate the consequences
-
CocoaPods/blog.cocoapods.org#59 should be updated to explicitly include this information, since it's a significant limitation.
Yes this is correct (summarised this on Alamofire/Alamofire#287 (comment)).
This will be an actually lint error by the 0.36 release. Enforcing that Swift pod's platform is set correctly (see CocoaPods/CocoaPods#2963).
I think it make's sense to put this in the blog post. /cc @mrackwitz Perhaps this should also make it into the guides by the release of CocoaPods 0.36.
Is there no way to provide a static framework with Swift and iOS 7+ support? Like iOS-Universal-Framework project.
For the moment, I use CocoaPods for Objective-C dependency (so it produce static library) and submodules for swift dependency.
@getaaron: As @kylef states, this will be an error, which will cause rejection of the podspec. I don't think this has to be necessarily stated into the blog post, as this is a general limitation of the OS / distribution platform and not the dependency manager.
@kylef: 👍
@ValCapri: No, static frameworks are unlinked. Swift has to be linked because of it's dynamic standard libraries.
@mrackwitz I think it's worth including in the blog post even though it's not a CocoaPods limitation, mostly because I suspect it will catch many people by surprise.
Conclusion here, Cocoapods with swift support will only work on iOS 8+?
I'm thinking to start using the latest Cocoapods with Swift support for my project, where I'm supporting iOS 7+.
@AvdLee this is correct, Swift on iOS 7 only works if you copy the files into your application project.
I drafted a little paragraph that could be part of the eventual 0.36 release blog post: https://gist.github.com/neonichu/acd533ab9fcce4cf3a1b - this should avoid unnecessary discussions on whether this is a CP limitation or whether it is temporary or not, as we can already see that for some reasons people are debating this.
https://gist.github.com/getaaron/73a3a5eb776613681389 has some minor formatting and copy suggestions. (I also noted this in @neonichu's gist.)
Done with CocoaPods/blog.cocoapods.org@6933ae5.