Swift Version NativeScript

前端 未结 5 766
醉梦人生
醉梦人生 2020-12-30 16:27

Using NativeScript how can I run a project under iOS? I get these messages when I run tns run iOS --bundle

Webpack compilation complete. Watchin         


        
5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-30 16:52

    Here is the real fix ! You can't stick with Cocoapods 1.5.3 forever...

    Downgrading to 1.5.3 isn't a proper workaround and will not be sustainable in the future. In fact, this error is due to a new behavior introduced in Cocoapods 1.6.0 version, which force developers to set a Swift version to their projects. The goal is in fact to make library developers specify a Swift version in their podspec, so that library users don't have to do this manually (thanks to post_install scripts for example). You can see my discussion about this with a Cocoapods maintainer here. I do agree that this behavior is a bit misleading, as we try to set the Swift version in post_install script but an error is returned before…

    In fact, as I have been told by the maintainer, the correct fix to this issue is to set a Swift version at project level (and therefore not at Pod level). To do this, just add a new User Defined Setting in Build Settings, with key SWIFT_VERSION and value 4.0 (for example, as whatever value should work here if you also set the version at Pod level with post_install script).

    Long story short, the fix is to add this key/value :

    Note that as you're using NativeScript, you may want to set the Swift version by running command export SWIFT_VERSION=4 in your project folder, before building.

提交回复
热议问题