BLWebSocketsServer icon indicating copy to clipboard operation
BLWebSocketsServer copied to clipboard

Advice on using with Swift with a framework target

Open paulyoung opened this issue 10 years ago • 7 comments

I'm having some trouble adding BLWebSocketsServer to a Swift project with a framework as a target.

I've tried adding the BLWebSocketsServer in several ways and followed Apple's guidelines in adding the import statement to my umbrella header.

@benlodotcom - do you think you could give this a try and see if you can figure it out?

Thanks!

paulyoung avatar Aug 30 '14 05:08 paulyoung

These are the steps I've taken:

Step 1 git add submodule [email protected]:benlodotcom/BLWebSocketsServer.git External/BLWebSocketsServer

Step 2 Added the BLWebSocketsDirectory (Added folders: Create groups)

Step 3 Linked libz.dylib with the target

Step 4 Tried to build: screen shot 2014-08-30 at 02 13 22

Step 5 Set "Treat Warnings as Errors" to "No" (for now).

Step 6 Tried to build. 21 issues, mostly "Implicit conversion loses integer precision" warnings, and:

screen shot 2014-08-30 at 02 14 32

Worth noting that at this point at haven't even tried importing the header file and gotten into anything Swift related yet.

paulyoung avatar Aug 30 '14 06:08 paulyoung

So, contrary to the README, adding -fno-objc-arc to BLWebSocketsServer.m in Build Phases -> Compile Sources caused the build to succeed.

After that I needed to move BLWebSocketsServer.h to Public in Build Phases -> Compile Sources in order to import it in my umbrella header file and have the build succeed.

This appears to work although there are lots of warnings.

paulyoung avatar Aug 30 '14 06:08 paulyoung

Re-opened just get some clarity on the ARC flag, and anything else I may have done incorrectly.

paulyoung avatar Aug 31 '14 04:08 paulyoung

I haven't tried this yet, did you get other warnings apart from the one you describe in #7 ?

benlodotcom avatar Sep 06 '14 03:09 benlodotcom

Only the ones mentioned in step 6.

paulyoung avatar Sep 07 '14 05:09 paulyoung

Just want to add that this is not related to swift - I added the project to an objective-c framework of mine and also got a compiler error on the use of dispatch_release().

BlackWolf avatar Feb 25 '15 07:02 BlackWolf

I should remove this now, this was necessary only for < iOS 6 support.

benlodotcom avatar Feb 25 '15 07:02 benlodotcom