When building with Sidekick for iOS in the cloud for the release I get the following error:
[19-04-21 17:33:16.698] (CLI) App_Resources/iOS/[email protected] 14.7 KiB [emitted]
[19-04-21 17:33:16.698] (CLI) App_Resources/iOS/[email protected] 15.2 KiB [emitted]
[19-04-21 17:33:16.698] (CLI) App_Resources/iOS/build.xcconfig 504 bytes [emitted]
[19-04-21 17:33:16.698] (CLI) App_Resources/iOS/GoogleService-Info.plist 1.38 KiB [emitted]
[19-04-21 17:33:16.698] (CLI) App_Resources/iOS/Info.plist 1.47 KiB [emitted]
[19-04-21 17:33:16.698] (CLI) App_Resources/iOS/LaunchScreen.storyboard 3.84 KiB [emitted]
[19-04-21 17:33:16.698] (CLI) App_Resources/iOS/PodFile 207 bytes [emitted]
[19-04-21 17:33:16.698] (CLI) assets/images/fork.png 18.8 KiB [emitted]
[19-04-21 17:33:16.698] (CLI) assets/images/hero.png 113 KiB [emitted]
[19-04-21 17:33:16.698] (CLI) assets/images/star.png 18.5 KiB [emitted]
[19-04-21 17:33:16.698] (CLI) package.json 129 bytes [emitted]
[19-04-21 17:33:16.698] (CLI) starter.js 39 bytes [emitted]
[19-04-21 17:33:16.698] (CLI) Entrypoint bundle = vendor.js bundle.js
[19-04-21 17:33:16.698] (CLI) [../node_modules/babel-loader/lib/index.js!../node_modules/vue-loader/lib/index.js?!./views/News.vue?vue&type=script&lang=js&] ../node_modules/babel-loader/lib!../node_modules/vue-loader/lib??vue-loader-options!./views/News.vue?vue&type=script&lang=js& 8.53 KiB {bundle} [built]
[19-04-21 17:33:16.698] (CLI) [./ sync ^\\.\\/app\\.(css|scss|less|sass)$] . sync nonrecursive ^\\.\\/app\\.(css|scss|less|sass)$ 175 bytes {bundle} [built]
[19-04-21 17:33:16.698] (CLI) [./ sync recursive (root|page)\\.(xml|css|js|ts|scss)$] . sync (root|page)\\.(xml|css|js|ts|scss)$ 160 bytes {bundle} [built]
[19-04-21 17:33:16.698] (CLI) [./main.js] 2.44 KiB {bundle} [built]
[19-04-21 17:33:16.698] (CLI) [./services/fetchGitnews.js] 5.29 KiB {bundle} [built]
[19-04-21 17:33:16.698] (CLI) [./services/getReadme.js] 18.8 KiB {bundle} [built]
[19-04-21 17:33:16.698] (CLI) [./store/index.js] 280 bytes {bundle} [built]
[19-04-21 17:33:16.698] (CLI) [./store/modules/news.js] 3.58 KiB {bundle} [built]
[19-04-21 17:33:16.698] (CLI) [./store/modules/readme.js] 1.53 KiB {bundle} [built]
[19-04-21 17:33:16.698] (CLI) [./store/modules/settings.js] 1.12 KiB {bundle} [built]
[19-04-21 17:33:16.698] (CLI) [./store/mutation-types.js] 744 bytes {bundle} [built]
[19-04-21 17:33:16.698] (CLI) [./views/News.vue] 1.2 KiB {bundle} [built]
[19-04-21 17:33:16.698] (CLI) [./views/News.vue?vue&type=script&lang=js&] 346 bytes {bundle} [built]
[19-04-21 17:33:16.698] (CLI) [./views/News.vue?vue&type=style&index=0&id=58888802&scoped=true&lang=css&] 796 bytes {bundle} [built]
[19-04-21 17:33:16.698] (CLI) [./views/News.vue?vue&type=template&id=58888802&scoped=true&] 214 bytes {bundle} [built]
[19-04-21 17:33:16.698] (CLI) + 272 hidden modules
[19-04-21 17:33:16.698] (CLI) Webpack compilation complete.
[19-04-21 17:33:19.687] (CLI) Installing pods...
[19-04-21 17:33:21.240] (CLI) Analyzing dependencies
[19-04-21 17:33:21.240] (CLI) Downloading dependencies
[19-04-21 17:33:21.240] (CLI) Installing Firebase (5.6.0)
[19-04-21 17:33:21.240] (CLI) Installing FirebaseAnalytics (5.1.1)
[19-04-21 17:33:21.240] (CLI) Installing FirebaseCore (5.1.1)
[19-04-21 17:33:21.240] (CLI) Installing FirebaseInstanceID (3.2.1)
[19-04-21 17:33:21.240] (CLI) Installing GoogleAppMeasurement (5.8.1)
[19-04-21 17:33:21.240] (CLI) Installing GoogleUtilities (5.2.3)
[19-04-21 17:33:21.240] (CLI) Installing Socket.IO-Client-Swift (11.1.3)
[19-04-21 17:33:21.240] (CLI) Installing StarscreamSocketIO (8.0.7)
[19-04-21 17:33:21.240] (CLI) Installing Toaster (2.0.4)
[19-04-21 17:33:21.240] (CLI) Installing nanopb (0.3.901)
[19-04-21 17:33:21.240] (CLI) [!] Unable to determine Swift version for the following pods:
[19-04-21 17:33:21.240] (CLI) - `Socket.IO-Client-Swift` does not specify a Swift version and none of the targets (`gitnews`) integrating it have the `SWIFT_VERSION` attribute set. Please contact the author or set the `SWIFT_VERSION` attribute in at least one of the targets that integrate this pod.
[19-04-21 17:33:21.240] (CLI) - `StarscreamSocketIO` does not specify a Swift version and none of the targets (`gitnews`) integrating it have the `SWIFT_VERSION` attribute set. Please contact the author or set the `SWIFT_VERSION` attribute in at least one of the targets that integrate this pod.
[19-04-21 17:33:21.240] (CLI) - `Toaster` does not specify a Swift version and none of the targets (`gitnews`) integrating it have the `SWIFT_VERSION` attribute set. Please contact the author or set the `SWIFT_VERSION` attribute in at least one of the targets that integrate this pod.
[19-04-21 17:33:21.240] (CLI) [!] Automatically assigning platform `ios` with version `9.0` on target `gitnews` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
[19-04-21 17:33:21.240] (CLI) 'pod install' command failed.
[19-04-21 17:33:22.763] (CLI) clean-webpack-plugin: /private/tmp/builds/_/c807f4e01e6ac063c1b09d4fbaef956ea909e125/5.3.2/5.3.1/gitnews/platforms/ios/gitnews/app/**/* has been removed.
[19-04-21 17:33:22.763] (CLI) Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade caniuse-lite browserslist`
[19-04-21 17:33:22.763] (CLI) 'pod install' command failed.
[19-04-21 17:33:33.785] Build step completed.
I tried this by adding a PodFile in app/AppResources/Platform/iOS
https://medium.com/@championswimmer/setting-swift-version-in-nativescript-6ece09112a46z
But it doesn't work maybe because it's built on the cloud.
Hey @sandoche ,
We have investigated this case and the problem is related to some changes applied in cocapods 1.6.0 and later. In the cloud builds we are using Cocoapods 1.6.x, so that's why you faced the issue. It can be easily reproduced with local build as well by following these steps:
$ pod --version # in case the installed version is not 1.6.x or later, install new one with sudo gem update cocoapods
$ tns create myApp
$ cd myApp
$ npm i --save nativescript-socket.io
$ tns build ios
The workaround you've tried to use (https://medium.com/@championswimmer/setting-swift-version-in-nativescript-6ece09112a46) is not working with Cocoapods 1.6.x as the pods themselves have broken it - you never get to the post_install task of the Cocoapods when there's some SWIFT related error. The recommendation from Cocoapods is to contact Pods author to update the pod itself (i.e. not the Podfile you receive in the project, but the actual Cocoapod that is downloaded when the project is built) with information about its SWIFT version.
The current way to workaround this is by using pre_install script in your Podfile as described here: https://github.com/CocoaPods/CocoaPods/issues/8118#issuecomment-450796157
So, to resolve your error, you can add a Podfile in your App_Resources/iOS directory with the following content:
pre_install do |installer|
installer.analysis_result.specifications.each do |s|
if s.name == 'Socket.IO-Client-Swift' || s.name == 'Starscream' || s.name == 'StarscreamSocketIO' || s.name == 'Toaster'
s.swift_version = '4.2'
end
end
end
Can you give it a try and inform us if it works for you?
Hi thanks for your solution.
It worked but I got stuck later on another bug: https://github.com/NativeScript/nativescript-cli/issues/4562
Not that when I was using NativeScript CLI 5.0 I didn't get any of these errors with the cloud build.
@sandoche , NativeScript 5.0 works with older version of Cocoapods in the cloud, so it is expected to have difference in the behavior.
As the current problem is resolved, I'm closing this issue.
The pre_install hook didn't work for me. Alternatively, you can set the Swift version by including e.g. ENV['SWIFT_VERSION'] = '3' at the top of your Podfile.
Most helpful comment
Hey @sandoche ,
We have investigated this case and the problem is related to some changes applied in cocapods 1.6.0 and later. In the cloud builds we are using Cocoapods 1.6.x, so that's why you faced the issue. It can be easily reproduced with local build as well by following these steps:
The workaround you've tried to use (https://medium.com/@championswimmer/setting-swift-version-in-nativescript-6ece09112a46) is not working with Cocoapods 1.6.x as the pods themselves have broken it - you never get to the post_install task of the Cocoapods when there's some SWIFT related error. The recommendation from Cocoapods is to contact Pods author to update the pod itself (i.e. not the Podfile you receive in the project, but the actual Cocoapod that is downloaded when the project is built) with information about its SWIFT version.
The current way to workaround this is by using pre_install script in your Podfile as described here: https://github.com/CocoaPods/CocoaPods/issues/8118#issuecomment-450796157
So, to resolve your error, you can add a Podfile in your
App_Resources/iOSdirectory with the following content:Can you give it a try and inform us if it works for you?