tunnel_server in SimpleTunnel(V1.3) can't convert to Swift 3.0

tunnel_server in SimpleTunnel can't convert to Swift 3.0 by Xcode


I download SimpleTunnel(https://developer.apple.com/library/content/samplecode/SimpleTunnel/Introduction/Intro.html) this version


Last Revision:

Version 1.3, 2016-10-04
Updated to Swift 3

But when I run tunnel_server , it told me need convert Swift3.0.



Replies

Userd Edit->Convert->To current Swift Syntax

You don’t need to convert this to Swift 3; you can continue building it with Swift 2.3 for the moment. And given the low-level nature of this code, I recommend you do that rather than trying to do the conversion yourself.

Also, please file a bug against the sample requesting that it be updated to Swift 3, then post your bug number here, just for the record.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

How I can build it with Swift 2.3 in Xcode 8.1? whats the procedure?


Regards

I try XCODE 7 ,XCODE 7.2 ,XCODE 8 , All could not build the tunnel_server.


Because Tunnel.swift is write by swift 3.


But ServerTunnel.swift write by swift 2.3


So no way to build tunnel_server.


Can you please update the SimpleTunnel project to work on XCODE 8.1 ?

Thank you

Can you please update the SimpleTunnel project to work on XCODE 8.1 ?

You should request this officially by filing a bug against the SimpleTunnel sample code. Please post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Update the SimpleTunnel project(tunnel server) to work on Xcode8.1... plz~~~~

Update the SimpleTunnel project(tunnel server) to work on Xcode8.1

Posting requests like this here does not help; please follow the advice from my previous (Dec 4) post.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

I have filed a bug for this. Ticket number is 29682328

I have a version that builds in XCode 8.1 (manul conversion with the help of Eskimo).

Unfortunately it deos not seem to work as expected, as when you toggle the Tunnel Server's VPN on it opens a tunnel but then gets stuck in "Connecting" state. If anyone fancies to take a look at it I'll be happy to share the code 🙂.

Just FYI, you’ll want to use Xcode 8.2. There’s a bug in the SDKs that shipped with 8.1 that causes the provider to crash (r. 28756704). Specifically, the

data
parameter of the completion handler passed to
-[NWTCPConnection readLength:completionHandler:]
is flagged as not nullable in the Xcode 8.1 SDKs, which is a problem because that parameter can be nil. Likewise with NWUDPSession.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

I too was able to run client part of the project. But the server target fails to build even after converting to Swift 2.3 or Swift 3.


In the end, I had to pull the old source code from a Github repo and build with Xcode 7.1

Thanks Eskimo, updated but still no luck with it. Are you aware of any timeframe for the SimpleTunnel app to be updated to xCode8.2?

It seems like there is something obviously not quite right in my updated version, and it'd be great to have a fresh start with a project that the Apple devs

have updated and proved working with the latest toolchain.

P.s: I know the real world is not as simple as Apple insider and rest-of-the-world, but you're our only point of contact and and best resource out here 🙂.

Thanks Pany, that's a viable solution assuming you are not restricted to deploying and testing on iOS10+ devices, which XCode7 doen't not support.

And did not upgrade to Sierra which in turn requires xCode 8. Unfortunately I am constrained by both of the above so that's not going to work for me.

I am now trying to use the Swift 2.3 toolchain in XCode 8.2 and enabling "Use Legacy Swift Code" to see if I have more luck with it, but it complains about the Swift 2.3 value being overridden by the TOOLCHAIN build setting (...).

Interestingly enough, it seems easier to use a variety of Swift toolchains on Linux than on MacOS (although I am sure that some fo you guys have managed a working toolchain with SimpleTunnel).

It could be useful to set up a Slack channel with all interested devs working on the Network Extensions: I've found that a life safer when working on Swift server side (PerfectServer across intermediate Swift3 snapshots) as it allows for instantanous sharing of knowledge / common troublshooting.


EDIT: I managed to make it work by using the "old" (Swift 2.x) code for the Project, built via XCode 8.2 with "Use lgacy Swift" enabled. That only required a few minor tweaks to update to Swift 2.3 and it works as expected. Still have to fix some nat configuration as I the server does not seem to be able to route the DNS response back to the tunnel interface (and therefore Safari on my iPhone cannot browse), but at least I can see the traffic running through.

Are you aware of any timeframe for the SimpleTunnel app to be updated to Xcode 8.2?

No. If I had time I’d do this myself but, alas, I’m buried in DTS incidents at the moment )-:

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Fair enough. If at some point you reckon you have time to take a look / start from from a version that builds on 8.2, feel free to ping me and I'll be more than happy to send it over. You may just end up finding that it works fine after all and I am just facing some unrelated issue.