Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error by IOS, says Socket.IO-Client-Swift does not specify a Swift version and none of the targets (testApp) integrating it have the SWIFT_VERSION attribute set. #71

Closed
yueguanyu opened this issue Oct 7, 2018 · 29 comments

Comments

@yueguanyu
Copy link

Which platform(s) does your issue occur on?

  • iOS
  • 10.0
  • emulator XS Max

Please, provide the following version numbers that your issue occurs with:

  • CLI: 4.2.4
  • Cross-platform modules: "4.2.1"
  • Runtime(s):
    "tns-android": {
    "version": "4.2.0"
    },
    "tns-ios": {
    "version": "4.2.0"
    }
  • Plugin(s):
    "dependencies": {
    "@angular/animations": "~6.1.0",
    "@angular/common": "~6.1.0",
    "@angular/compiler": "~6.1.0",
    "@angular/core": "~6.1.0",
    "@angular/forms": "~6.1.0",
    "@angular/http": "~6.1.0",
    "@angular/platform-browser": "~6.1.0",
    "@angular/platform-browser-dynamic": "~6.1.0",
    "@angular/router": "~6.1.0",
    "nativescript-angular": "~6.1.0",
    "nativescript-socketio": "^3.2.1",
    "nativescript-theme-core": "~1.0.4",
    "nativescript-ui-autocomplete": "^3.9.0",
    "nativescript-ui-calendar": "^3.9.0",
    "nativescript-ui-chart": "^3.9.0",
    "nativescript-ui-gauge": "3.7.1",
    "nativescript-ui-listview": "^3.7.1",
    "nativescript-ui-sidedrawer": "~4.3.0",
    "reflect-metadata": "~0.1.10",
    "rxjs": "~6.2.0",
    "tns-core-modules": "~4.2.0",
    "zone.js": "~0.8.18"
    },
    "devDependencies": {
    "@angular/compiler-cli": "~6.1.0",
    "@nativescript/schematics": "~0.3.0",
    "@ngtools/webpack": "~6.2.0",
    "codelyzer": "~4.3.0",
    "nativescript-dev-sass": "~1.6.0",
    "nativescript-dev-typescript": "~0.7.0",
    "nativescript-dev-webpack": "~0.16.0",
    "nativescript-ui-dataform": "3.7.3",
    "tslint": "~5.11.0",
    "typescript": "~2.7.2"
    },

Please, tell us how to recreate the issue in as much detail as possible.

tns plugin add nativescript-socketio
then i had platform unspecified Error. Then i change my Podfile to this:
use_frameworks!
platform :ios, '10.0'

target "testApp" do

Begin Podfile - /Users/mac/develop/gitstore/apps/testApp/node_modules/nativescript-socketio/platforms/ios/Podfile

pod 'Socket.IO-Client-Swift', :git => 'https://github.com/triniwiz/socket.io-client-swift.git'

pod 'Socket.IO-Client-Swift', '~> 12.0.0'

End Podfile

end

post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '4.2'
end
end
end

But I got always another problem: Socket.IO-Client-Swift does not specify a Swift version and none of the targets (testApp) 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.\n- Starscream does not specify a Swift version and none of the targets (testApp) 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.

I had added the follows to my Podfile, but it still not work, even I change the SWIFT_VERSION = '3.0'.
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '4.2'
end
end
end

Is there any code involved?

I cannot open my project with Xcode 10 correctly, so I cannot set the SWIFT_VERSION with the Editor's build setting.

@yueguanyu
Copy link
Author

2018-10-07 1 44 31
when I use pod repo update and pod install, to install the socket.io-client-swift with last version, I got still this Issue.

@yueguanyu
Copy link
Author

this is my Podfile
2018-10-07 1 49 30

@triniwiz
Copy link
Owner

triniwiz commented Oct 7, 2018

I don't set a swift version so if you ignore the Socket.IO-Client-Swift it will work

@yueguanyu
Copy link
Author

Do you mean to remove the pod ‘Socket.IO-Client-Swift’, which one is with the cli: tns run ios automatically added in the Podfile?

@triniwiz
Copy link
Owner

triniwiz commented Oct 7, 2018

post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '4.2'
end
end
end

Forces all your pods to use swift version 4.2 that's not needed for the socket.io pod

@yueguanyu
Copy link
Author

At first I just do tns run iOS, then I got this Error:
Socket.IO-Client-Swift does not specify a Swift version and none of the targets (testApp) integrating it have the SWIFT_VERSION attribute set.
Then I try to specify the swift_version in the Podfile, but it still not work. I was under Xcode 10.0, when I use tns run iOS to run the demo, I got the same error.

@triniwiz
Copy link
Owner

triniwiz commented Oct 7, 2018

Can you delete the platforms, node_modules and package-lock.json and try running the project again i'm using the package with xcode 10 and it works

@yueguanyu
Copy link
Author

yueguanyu commented Oct 8, 2018

I had the platforms, node_modules and package-lock.json deleted. And try running: tns run ios, and I had the Error again. As the image.
2018-10-08 10 18 00

@triniwiz
Copy link
Owner

triniwiz commented Oct 8, 2018

Thanks for the update

@yueguanyu
Copy link
Author

I had all the others plugins removed, and successfully run up. I guess that would be a Problem with the plugins, some plugin may use the different swift_version and not declared. I’ll try the Kombination with different official-plugins. I’ll report later!

@yueguanyu
Copy link
Author

I have changed to use another Macbook, and it passed. But with my IMAC is there always problems with the SWIFT_VERSION. I don't know why....

@yueguanyu
Copy link
Author

I got the same problem on another mac mini.
2018-10-09 10 14 03
2018-10-09 10 15 22
2018-10-09 10 23 03

@kefahB
Copy link

kefahB commented Nov 7, 2018

Hi, if you have the last version of Websocket.io (2.5.0) and you have updated to the latest take a look in your PodFile and chek if ther is no double declaration of swift ?

@maganius
Copy link

I have same error, some fix for it?
[!] Unable to determine Swift version for the following pods:

- `Socket.IO-Client-Swift` does not specify a Swift version and none of the targets (`cardiologia2018`) 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.
- `StarscreamSocketIO` does not specify a Swift version and none of the targets (`cardiologia2018`) 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.
- `Toaster` does not specify a Swift version and none of the targets (`cardiologia2018`) 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.

[!] Automatically assigning platform `ios` with version `8.0` on target `cardiologia2018` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
Unable to apply changes on device: d44b3a513025352f8d92a1178d66cb5840bfffd2. Error is: 'pod install' command failed..

@yueguanyu
Copy link
Author

Hi, if you have the last version of Websocket.io (2.5.0) and you have updated to the latest take a look in your PodFile and chek if ther is no double declaration of swift ?

I have no dependence Websocket.io (2.5.0), the nativescript-socketio is depend on the Socket.IO-Client-Swift on IOS.

But I have found one Declaration of swift in the Local Podspecs, like that.
2018-11-18 2 40 47

@yueguanyu
Copy link
Author

I have same error, some fix for it?
[!] Unable to determine Swift version for the following pods:

- `Socket.IO-Client-Swift` does not specify a Swift version and none of the targets (`cardiologia2018`) 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.
- `StarscreamSocketIO` does not specify a Swift version and none of the targets (`cardiologia2018`) 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.
- `Toaster` does not specify a Swift version and none of the targets (`cardiologia2018`) 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.

[!] Automatically assigning platform `ios` with version `8.0` on target `cardiologia2018` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
Unable to apply changes on device: d44b3a513025352f8d92a1178d66cb5840bfffd2. Error is: 'pod install' command failed..

No, I have not found a way to fix it, but it works on the Macbook, so I have easy change the Maschine.

@kefahB
Copy link

kefahB commented Nov 18, 2018

Hi,
Look at the Podfile located in platforms/ios/Podfile and see if there is tow declaration of swift, you must have this :

 pod 'Socket.IO-Client-Swift', :git => 'https://github.com/triniwiz/socket.io-client-swift.git'

@kefahB
Copy link

kefahB commented Nov 18, 2018

If you have tow declarations of swift, keep pod 'Socket.IO-Client-Swift', :git => 'https://github.com/triniwiz/socket.io-client-swift.git' and delete the other one then rebuild
or run :

rm -Rf platforms hooks node_modules
tns install

@maganius
Copy link

@kefahB I have this in podfile pod 'Socket.IO-Client-Swift', '~> 11.0', If i change to your suggest, I save it and after delete platforms where is saved my changes?

@kefahB
Copy link

kefahB commented Nov 19, 2018

Hi @maganius,

you have just to comment this and add pod 'Socket.IO-Client-Swift', :git => 'https://github.com/triniwiz/socket.io-client-swift.git' BUT ensure that you have the latest

@kefahB
Copy link

kefahB commented Nov 19, 2018

if the error still run

rm -Rf platforms hooks node_modules
tns install

@maganius
Copy link

I fixed it with a fresh installation of nativescript and put my files in the new installation.
I dont know why this way work, but im happy : )

@joeelia
Copy link

joeelia commented Feb 8, 2019

Both these answers on StackOverflow fixed my issue. I was having the same issue. I tried reinstalling Nativescript and updating brew etc.... Downgrading cocopods worked for me and also putting export SWIFT_VERSION=3
in command terminal fixed it

https://stackoverflow.com/questions/53009550/swift-version-nativescript

@triniwiz
Copy link
Owner

triniwiz commented Feb 8, 2019

It should be fixed now to use swift 4 you will need to nuke the project

@mmccaff
Copy link

mmccaff commented Feb 28, 2019

Everything works for me if I set

export SWIFT_VERSION=3

However if not set, or set to 4, the app will not run. Even with a fresh build after a new npm install.

What do I need to pull a new version of, and what version, to get the fix for swift 4?

@triniwiz
Copy link
Owner

triniwiz commented Mar 1, 2019

@mmccaff u need to delete the platforms directory

@ghost
Copy link

ghost commented Mar 4, 2019

Fresh install today and I got the exact same problem.

The stackoverflow link (cocoapods 1.6.0 to 1.5.3) fixe the problem.

@damowanglidong
Copy link

cocoapods 降低到1.5.3解决了我的问题

@BradHoffman96
Copy link

I am getting errors when following the stack overflow link. Minimum required version for cocoa pods is 1.6.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants