triniwiz / nativescript-socketio

Socket.IO for nativescript
Apache License 2.0
71 stars 31 forks source link

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 closed 5 years ago

yueguanyu commented 6 years ago

Which platform(s) does your issue occur on?

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

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 commented 6 years ago

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 commented 6 years ago

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

triniwiz commented 6 years ago

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

yueguanyu commented 6 years ago

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 commented 6 years ago
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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

Thanks for the update

yueguanyu commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

@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 commented 6 years ago

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 commented 6 years ago

if the error still run

rm -Rf platforms hooks node_modules
tns install
maganius commented 6 years ago

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 commented 5 years ago

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 commented 5 years ago

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

mmccaff commented 5 years ago

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 commented 5 years ago

@mmccaff u need to delete the platforms directory

ghost commented 5 years ago

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 commented 5 years ago

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

BradHoffman96 commented 5 years ago

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