RMQClient and Swift3?

146 views
Skip to first unread message

Travis Griggs

unread,
Oct 18, 2016, 6:44:29 PM10/18/16
to rabbitmq-users
I have an app in Swift3 under XCode8 targeted at iOS10.0. I wanted to begin playing with integrating a rabbitmq client into it and see how well that worked. It was my first chance to switch from cocoapods to carthage. Upon bootstrap, I got a *lot* of warnings of the ilk:

/Users/travisg/Projects/twigpilot_remote_ios/Carthage/Checkouts/CocoaAsyncSocket/Source/RunLoop/AsyncSocket.m:4282:38: warning: 'AsyncSocket' is deprecated: The RunLoop versions of CocoaAsyncSocket are deprecated and will be removed in a future release. Please migrate to GCDAsyncSocket. [-Wdeprecated-declarations]


But it seemed to build OK. When I start up my app though, without even changing any other code, my app crashes:


dyld: Library not loaded: @rpath/CocoaAsyncSocket.framework/CocoaAsyncSocket

  Referenced from: /private/var/containers/Bundle/Application/92A79DA4-28B1-467E-B944-87CD7BB33594/twigpilot_remote_ios.app/Frameworks/RMQClient.framework/RMQClient

  Reason: no suitable image found.  Did find:

/private/var/containers/Bundle/Application/92A79DA4-28B1-467E-B944-87CD7BB33594/twigpilot_remote_ios.app/Frameworks/RMQClient.framework/Frameworks/CocoaAsyncSocket.framework/CocoaAsyncSocket: required code signature missing for '/private/var/containers/Bundle/Application/92A79DA4-28B1-467E-B944-87CD7BB33594/twigpilot_remote_ios.app/Frameworks/RMQClient.framework/Frameworks/CocoaAsyncSocket.framework/CocoaAsyncSocket'


Am I jumping the gun too much here? Or did I miss a step in there somewhere?



Michael Klishin

unread,
Oct 19, 2016, 12:10:06 AM10/19/16
to rabbitm...@googlegroups.com
Swift 3 support is a work in progress in master.
--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Andrew Bruce

unread,
Oct 19, 2016, 4:31:23 AM10/19/16
to rabbitm...@googlegroups.com
Travis,


I just tested a new Swift 3 project using those instructions and could make a connection and publish / subscribe.

When you do get it building, note that Swift 3 doesn't complete `publish` very well. You need parens around the block to disambiguate with the two-arity version: https://github.com/rabbitmq/rabbitmq-objc-client/issues/99

Travis Griggs

unread,
Oct 19, 2016, 10:51:18 AM10/19/16
to rabbitm...@googlegroups.com

On Oct 19, 2016, at 1:31 AM, Andrew Bruce <abr...@pivotal.io> wrote:

Travis,


I just tested a new Swift 3 project using those instructions and could make a connection and publish / subscribe.

When you do get it building, note that Swift 3 doesn't complete `publish` very well. You need parens around the block to disambiguate with the two-arity version: https://github.com/rabbitmq/rabbitmq-objc-client/issues/99

Does this (not) look correct?


(screenshot of my build phases)

Andrew Bruce

unread,
Oct 19, 2016, 4:43:44 PM10/19/16
to rabbitm...@googlegroups.com
Looks correct. Still no image found? Does it work in a new project?

Travis Griggs

unread,
Oct 19, 2016, 6:54:16 PM10/19/16
to rabbitmq-users
On Wednesday, October 19, 2016 at 1:43:44 PM UTC-7, Andrew Bruce wrote:
Looks correct. Still no image found? Does it work in a new project?

Great question. I created a brand new Project (SwiftHeartRabbit). Single View application iOS. Built it, ran it on my phone. Worked fine. Closed XCode.

Copied my single line cart file

$ cat Cartfile

 
github
"rabbitmq/rabbitmq-objc-client" ~> 0.10.0


Bootstrapped...


$ carthage bootstrap --platform iOS



*** No Cartfile.resolved found, updating dependencies

*** Fetching rabbitmq-objc-client

*** Fetching JKVValue

*** Fetching CocoaAsyncSocket

*** Checking out CocoaAsyncSocket at "7.5.0"

*** Checking out JKVValue at "v1.3.1"

*** Checking out rabbitmq-objc-client at "v0.10.0"

*** xcodebuild output can be found in /var/folders/2k/6y8rslzn1m95gjpg534j7v8jzr03tz/T/carthage-xcodebuild.ueqSMW.log

*** Building scheme "iOS Framework" in CocoaAsyncSocket.xcodeproj

*** Building scheme "JKVValue-iOS" in JKVValue.xcodeproj

*** Building scheme "RMQClient" in RMQClient.xcodeproj

/Users/travisg/Projects/SwiftHeartRabbit/Carthage/Checkouts/CocoaAsyncSocket/Source/RunLoop/AsyncSocket.m:671:17: warning: Implementing deprecated class [-Wdeprecated-implementations]

 

/Users/travisg/Projects/SwiftHeartRabbit/Carthage/Checkouts/CocoaAsyncSocket/Source/RunLoop/AsyncSocket.m:4252:3: warning: 'AsyncSocket' is deprecated: The RunLoop versions of CocoaAsyncSocket are deprecated and will be removed in a future release. Please migrate to GCDAsyncSocket. [-Wdeprecated-declarations]

.

. <lots of the same>

.

/Users/travisg/Projects/SwiftHeartRabbit/Carthage/Checkouts/CocoaAsyncSocket/Source/RunLoop/AsyncUdpSocket.m:2307:41: warning: 'AsyncUdpSocket' is deprecated: The RunLoop versions of CocoaAsyncSocket are deprecated and will be removed in a future release. Please migrate to GCDAsyncUdpSocket. [-Wdeprecated-declarations]



Opened XCode and the SwiftHeartProject. Adjusted the link binary and added the copy phase steps. Ran on my iPhone again:


dyld: Library not loaded: @rpath/CocoaAsyncSocket.framework/CocoaAsyncSocket




 
Referenced from: /private/var/containers/Bundle/Application/640E2C82-0DD2-4782-97E3-0756B5386E81/SwiftHeartRabbit.app/Frameworks/RMQClient.framework/RMQClient


 
Reason: no suitable image found.  Did find:


 
/private/var/containers/Bundle/Application/640E2C82-0DD2-4782-97E3-0756B5386E81/SwiftHeartRabbit.app/Frameworks/RMQClient.framework/Frameworks/CocoaAsyncSocket.framework/CocoaAsyncSocket: required code signature missing for '/private/var/containers/Bundle/Application/640E2C82-0DD2-4782-97E3-0756B5386E81/SwiftHeartRabbit.app/Frameworks/RMQClient.framework/Frameworks/CocoaAsyncSocket.framework/CocoaAsyncSocket'






(lldb)


 


When you did your fresh build, did you see the same spewage about CocoaAsyncSocket?

Andrew Bruce

unread,
Oct 20, 2016, 10:36:11 AM10/20/16
to rabbitmq-users
The deprecation warnings come from CocoaAsyncSocket I believe. Yes, I've trained my eyes to ignore them for now. Feel free to look into hiding them if you're interested!

As for the code signature stuff, I would have to dig deeper.
--

Travis Griggs

unread,
Oct 20, 2016, 1:53:49 PM10/20/16
to rabbitmq-users
Thanks for the patience and the hints and the help Michael and Andrew. I got it working. I added both CocoaAsyncSockets and JKVValue as linked binaries and copied files (not sure I needed all of it, just decided to treat them all the same).


The dump of warnings when doing the carthage update doesn't go away. But it does compile and I can even send simple messages to a queue now.

Andrew Bruce

unread,
Oct 21, 2016, 10:24:48 AM10/21/16
to rabbitmq-users
Glad to hear you got it working. Ideally you wouldn't need to add those dependencies manually, because modules should be able to bring other modules in. Please post back if you figure out why / if you needed to add them as dependencies of your project.

--
Reply all
Reply to author
Forward
0 new messages