Cordova-plugin-iosrtc: Xcode 8.3 no longer allows builds with Swift 2.3

Created on 29 Mar 2017  路  16Comments  路  Source: cordova-rtc/cordova-plugin-iosrtc

All Swift 2.3 code needs to be refactored to 3.0 in order for Xcode 8.3 to build a cordova app. While deprecation has been warned for a while now (since 8.0) it's now a critical issue as no new builds can be created.

Most helpful comment

@nickmendes Speaking on behalf of the developers, please place this question in the public Google Group: https://groups.google.com/forum/#!forum/cordova-plugin-iosrtc

All 16 comments

This is already done in master branch.

There have been no releases since December 16th, so it is not intuitive that you need to pull a particular commit to get this change. I used the following cordova command to get the latest version of iosrtc into a new test project with only the iosrtc plugin added:

cordova create testapp
cd testapp
cordova platform add ios --save
cordova plugin add https://github.com/BasqueVoIPMafia/cordova-plugin-iosrtc.git#master --save
cordova platform rm ios
cordova platform add ios --save

Open the project in XCode 8.3 and it asks to update the code to latest version of Swift. Before doing so, it discovers 472 errors. I ignore this at first, confirm the build settings for Swift version 3.0. Then I go to Edit > Convert > Convert to latest swift code. It says no source changes necessary, but has 483 errors and says the Convert Failed.

Sorry - I forgot to add this. It asks if I want to update the build settings to the latest version of swift. I click update. It still shows 483 errors, but when I run on my iPad, it reduces this to 46 errors.

These are the errors:

/Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/iosrtcPlugin.swift:8:32: Use of undeclared type 'RTCPeerConnectionFactory' /Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/PluginRTCPeerConnection.swift:4:43: Use of undeclared type 'RTCPeerConnectionDelegate' /Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/PluginRTCPeerConnection.swift:4:70: Use of undeclared type 'RTCSessionDescriptionDelegate' /Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/PluginRTCPeerConnection.swift:4:101: Use of undeclared type 'RTCStatsDelegate' /Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/PluginMediaStream.swift:4:37: Use of undeclared type 'RTCMediaStreamDelegate' /Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/PluginMediaStreamTrack.swift:4:42: Use of undeclared type 'RTCMediaStreamTrackDelegate' /Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/PluginMediaStreamRenderer.swift:5:45: Use of undeclared type 'RTCEAGLVideoViewDelegate' /Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/PluginRTCDataChannel.swift:28:40: Use of undeclared type 'RTCDataChannelDelegate' /Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/PluginRTCDTMFSender.swift:4:39: Use of undeclared type 'RTCDTMFSenderDelegate' /Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/iosrtcPlugin.swift:38:3: Use of unresolved identifier 'RTCPeerConnectionFactory' /Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/iosrtcPlugin.swift:8:6: Did you mean 'rtcPeerConnectionFactory'? /Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/iosrtcPlugin.swift:41:35: Use of unresolved identifier 'RTCPeerConnectionFactory' /Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/iosrtcPlugin.swift:8:6: Did you mean 'rtcPeerConnectionFactory'? /Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/PluginGetUserMedia.swift:9:33: Use of undeclared type 'RTCPeerConnectionFactory' /Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/PluginRTCPeerConnection.swift:24:29: Use of undeclared type 'RTCPeerConnectionFactory' /Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/PluginMediaStream.swift:5:22: Use of undeclared type 'RTCMediaStream' /Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/PluginRTCTypes.swift:2:13: 'signalingStates' used within its own type /Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/PluginRTCTypes.swift:2:13: Could not infer type for 'signalingStates' /Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/PluginRTCTypes.swift:11:13: 'iceGatheringStates' used within its own type /Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/PluginRTCTypes.swift:11:13: Could not infer type for 'iceGatheringStates' /Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/PluginRTCTypes.swift:17:13: 'iceConnectionStates' used within its own type /Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/PluginRTCTypes.swift:17:13: Could not infer type for 'iceConnectionStates' /Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/PluginRTCTypes.swift:27:13: 'dataChannelStates' used within its own type /Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/PluginRTCTypes.swift:27:13: Could not infer type for 'dataChannelStates' /Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/PluginRTCTypes.swift:35:3: Use of unresolved identifier 'RTCTrackStateLive' /Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/PluginRTCTypes.swift:36:3: Use of unresolved identifier 'RTCTrackStateEnded' /Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/PluginRTCTypes.swift:28:3: Use of unresolved identifier 'kRTCDataChannelStateConnecting' /Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/PluginRTCTypes.swift:29:3: Use of unresolved identifier 'kRTCDataChannelStateOpen' /Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/PluginRTCTypes.swift:30:3: Use of unresolved identifier 'kRTCDataChannelStateClosing' /Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/PluginRTCTypes.swift:31:3: Use of unresolved identifier 'kRTCDataChannelStateClosed' /Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/PluginRTCTypes.swift:18:3: Use of unresolved identifier 'RTCICEConnectionNew' /Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/PluginRTCTypes.swift:19:3: Use of unresolved identifier 'RTCICEConnectionChecking' /Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/PluginRTCTypes.swift:20:3: Use of unresolved identifier 'RTCICEConnectionConnected' /Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/PluginRTCTypes.swift:21:3: Use of unresolved identifier 'RTCICEConnectionCompleted' /Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/PluginRTCTypes.swift:22:3: Use of unresolved identifier 'RTCICEConnectionFailed' /Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/PluginRTCTypes.swift:23:3: Use of unresolved identifier 'RTCICEConnectionDisconnected' /Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/PluginRTCTypes.swift:24:3: Use of unresolved identifier 'RTCICEConnectionClosed' /Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/PluginRTCTypes.swift:12:3: Use of unresolved identifier 'RTCICEGatheringNew' /Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/PluginRTCTypes.swift:13:3: Use of unresolved identifier 'RTCICEGatheringGathering' /Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/PluginRTCTypes.swift:14:3: Use of unresolved identifier 'RTCICEGatheringComplete' /Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/PluginRTCTypes.swift:3:3: Use of unresolved identifier 'RTCSignalingStable' /Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/PluginRTCTypes.swift:4:3: Use of unresolved identifier 'RTCSignalingHaveLocalOffer' /Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/PluginRTCTypes.swift:5:3: Use of unresolved identifier 'RTCSignalingHaveLocalPrAnswer' /Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/PluginRTCTypes.swift:6:3: Use of unresolved identifier 'RTCSignalingHaveRemoteOffer' /Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/PluginRTCTypes.swift:7:3: Use of unresolved identifier 'RTCSignalingHaveRemotePrAnswer' /Users/mikeblock/Documents/testapp/platforms/ios/testapp/Plugins/cordova-plugin-iosrtc/PluginRTCTypes.swift:8:3: Use of unresolved identifier 'RTCSignalingClosed'

I don't think the errors above are related to Swift 2 vs 3 at all...

i was able to go pass the same issue by not clicking refactor but changing SWIFT_VERSION field in Build Settings to "yes" instead

Are you in XCode 8.3? This is no longer in the build settings in 8.3 - it was removed...

Sorry, i was working on xcode 8.2.1. It seems like apple got rid of Use Legacy Swift Language Version option starting from 8.3 (http://stackoverflow.com/questions/42555538/xcode-8-3-beta-no-option-in-setting-for-use-legacy-swift-language-version)

I have set the version to 3.0 as required, executed Product > Clean and then rebuilt the project. I still get the undeclared issues. It seems that for some reason it's not pulling in the dependencies even though they are all part of the target. Any thoughts?

Have you used the provided hook? It explicitly sets the Swift version to 3.0, so you shouldn't get the conversion prompt.

I haven't tested with Xcode 8.3, I'll try to test it there tonight.

Success! I did have to run Product > Clean and then rebuild, but yes - we are good. So sorry to raise a panic. I really didn't consider the errors inconsequential to the Swift version change.

Nice, 4.0.0 release coming up then :-)

Any idea how long it takes 4.0.0 to be available in the cordova registry?

https://www.npmjs.com/package/cordova-plugin-iosrtc

Oops, I had forgotten to publish the package on npm! I just did that, thanks for the reminder!

@brianfleming, could you please provide the steps to be able to build in xcode 8.3 with 4.0.0 version of the plugin ?

Best Regards.

@nickmendes Speaking on behalf of the developers, please place this question in the public Google Group: https://groups.google.com/forum/#!forum/cordova-plugin-iosrtc

Was this page helpful?
0 / 5 - 0 ratings