Unable to connect in macOS or iOS from Xcode

When I try to connect to a RemObjects Server using an app built in Xcode I get the following stack trace when it tries to do the network call:

> 2019-12-24 15:01:44.375828-0800 AppServerTestMac[5619:551138] Metal API Validation Enabled
> 2019-12-24 15:01:55.100750-0800 AppServerTestMac[5619:551600] [] nw_socket_connect [C1:2] connectx(11 (guarded), [srcif=0, srcaddr=<NULL>, dstaddr=192.168.1.4:8090], SAE_ASSOCID_ANY, 0, NULL, 0, NULL, SAE_CONNID_ANY) failed: [1: Operation not permitted]
> 2019-12-24 15:01:55.100887-0800 AppServerTestMac[5619:551600] [] nw_socket_connect [C1:2] connectx failed (fd 11) [1: Operation not permitted]
> 2019-12-24 15:01:55.100923-0800 AppServerTestMac[5619:551600] [] nw_socket_connect connectx failed [1: Operation not permitted]
> 2019-12-24 15:01:55.101134-0800 AppServerTestMac[5619:551600] Connection 1: received failure notification
> 2019-12-24 15:01:55.101174-0800 AppServerTestMac[5619:551600] Connection 1: failed to connect 1:1, reason -1
> 2019-12-24 15:01:55.101200-0800 AppServerTestMac[5619:551600] Connection 1: encountered error(1:1)
> 2019-12-24 15:01:55.103354-0800 AppServerTestMac[5619:551600] Task <1DF9F90B-ADFB-4F3E-A422-BA055C95063F>.<0> HTTP load failed, 0/0 bytes (error code: 1 [1:1])
> 2019-12-24 15:01:55.103438-0800 AppServerTestMac[5619:551606] NSURLConnection finished with error - code 1
> 2019-12-24 15:01:55.112563-0800 AppServerTestMac[5619:551138] [General] Error dispatching message: The operation couldn’t be completed. Operation not permitted
> 2019-12-24 15:01:55.116550-0800 AppServerTestMac[5619:551138] [General] (
> 	0   CoreFoundation                      0x00007fff36d2d38b __exceptionPreprocess + 250
> 	1   libobjc.A.dylib                     0x00007fff6d065552 objc_exception_throw + 48
> 	2   RemObjectsSDK                       0x000000010051f165 -[ROHTTPClientChannel sendMessage:contentType:waitForReply:] + 1141
> 	3   RemObjectsSDK                       0x000000010051e704 -[ROHTTPClientChannel intDispatch:responseMessage:] + 388
> 	4   RemObjectsSDK                       0x0000000100517d17 -[ROClientChannel dispatch:] + 279
> 	5   AppServerTestMac                    0x00000001000725ba -[LoginService_Proxy GetAPIVersion] + 314
> 	6   AppServerTestMac                    0x00000001000bcaa6 $s16AppServerTestMac11ContentViewV7DoLoginyyF + 1174
> 	7   AppServerTestMac                    0x00000001000bc609 $s16AppServerTestMac11ContentViewV4bodyQrvg7SwiftUI05TupleF0VyAE4TextV_AE6ButtonVyAIGtGyXEfU_yycfU_ + 9
> 	8   SwiftUI                             0x00007fff43a1d2e9 $s7SwiftUI33PrimitiveButtonStyleConfigurationV7triggeryyF + 25
> 	9   SwiftUI                             0x00007fff43e4e2c0 $s7SwiftUI33PrimitiveButtonStyleConfigurationV7triggeryyFTA + 16
> 	10  SwiftUI                             0x00007fff43e4dfb9 $s7SwiftUI11Coordinator33_9FEBA96B0BC70E1682E82D239F242E73LLC14didPressButtonyySo8NSButtonCF + 25
> 	11  SwiftUI                             0x00007fff43e4dff6 $s7SwiftUI11Coordinator33_9FEBA96B0BC70E1682E82D239F242E73LLC14didPressButtonyySo8NSButtonCFTo + 38
> 	12  AppKit                              0x00007fff340ac018 -[NSApplication(NSResponder) sendAction:to:from:] + 299
> 	13  AppKit                              0x00007fff340abeb4 -[NSControl sendAction:to:] + 86
> 	14  AppKit                              0x00007fff340abde6 __26-[NSCell _sendActionFrom:]_block_invoke + 136
> 	15  AppKit                              0x00007fff340abce8 -[NSCell _sendActionFrom:] + 171
> 	16  AppKit                              0x00007fff340abc2f -[NSButtonCell _sendActionFrom:] + 96
> 	17  AppKit                              0x00007fff340a7ecd NSControlTrackMouse + 1745
> 	18  AppKit                              0x00007fff340a77d4 -[NSCell trackMouse:inRect:ofView:untilMouseUp:] + 130
> 	19  AppKit                              0x00007fff340a7694 -[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 691
> 	20  AppKit                              0x00007fff340a6a13 -[NSControl mouseDown:] + 748
> 	21  AppKit                              0x00007fff340a4ded -[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:] + 4907
> 	22  AppKit                              0x00007fff3400ef3c -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 2612
> 	23  AppKit                              0x00007fff3400e2e5 -[NSWindow(NSEventRouting) sendEvent:] + 349
> 	24  AppKit                              0x00007fff3400c65c -[NSApplication(NSEvent) sendEvent:] + 352
> 	25  AppKit                              0x00007fff33e583df -[NSApplication run] + 707
> 	26  AppKit                              0x00007fff33e2a775 NSApplicationMain + 777
> 	27  AppServerTestMac                    0x00000001000bf26d main + 13
> 	28  libdyld.dylib                       0x00007fff6e3c77fd start + 1
> )

I can reach this same endpoint from this machine with other apps and the browser.

Any ideas what is wrong?

Its our server URL http or https? iOS disallows non-encrypted http requests by default, uses you add a special Info.plist setting, such as

        <key>NSAppTransportSecurity</key>
        <dict>
            <key>NSAllowsArbitraryLoads</key>
            <true/>
        </dict>

The server is http. I added that key and value and still got this error:

> 2019-12-25 09:26:35.535545-0800 AppServerTestMac[6258:791446] Metal API Validation Enabled
> 2019-12-25 09:26:46.777576-0800 AppServerTestMac[6258:791874] [] nw_socket_connect [C1:2] connectx(11 (guarded), [srcif=0, srcaddr=<NULL>, dstaddr=192.168.1.4:8090], SAE_ASSOCID_ANY, 0, NULL, 0, NULL, SAE_CONNID_ANY) failed: [1: Operation not permitted]
> 2019-12-25 09:26:46.777696-0800 AppServerTestMac[6258:791874] [] nw_socket_connect [C1:2] connectx failed (fd 11) [1: Operation not permitted]
> 2019-12-25 09:26:46.777733-0800 AppServerTestMac[6258:791874] [] nw_socket_connect connectx failed [1: Operation not permitted]
> 2019-12-25 09:26:46.777963-0800 AppServerTestMac[6258:791874] Connection 1: received failure notification
> 2019-12-25 09:26:46.778015-0800 AppServerTestMac[6258:791874] Connection 1: failed to connect 1:1, reason -1
> 2019-12-25 09:26:46.778043-0800 AppServerTestMac[6258:791874] Connection 1: encountered error(1:1)
> 2019-12-25 09:26:46.779849-0800 AppServerTestMac[6258:791874] Task <31D89564-C3DF-412B-AA9E-8244C3538A02>.<0> HTTP load failed, 0/0 bytes (error code: 1 [1:1])
> 2019-12-25 09:26:46.779939-0800 AppServerTestMac[6258:791873] NSURLConnection finished with error - code 1
> 2019-12-25 09:26:46.789122-0800 AppServerTestMac[6258:791446] [General] Error dispatching message: The operation couldn’t be completed. Operation not permitted
> 2019-12-25 09:26:46.792610-0800 AppServerTestMac[6258:791446] [General] (
> 	0   CoreFoundation                      0x00007fff36d2d38b __exceptionPreprocess + 250
> 	1   libobjc.A.dylib                     0x00007fff6d065552 objc_exception_throw + 48
> 	2   RemObjectsSDK                       0x000000010051f165 -[ROHTTPClientChannel sendMessage:contentType:waitForReply:] + 1141
> 	3   RemObjectsSDK                       0x000000010051e704 -[ROHTTPClientChannel intDispatch:responseMessage:] + 388
> 	4   RemObjectsSDK                       0x0000000100517d17 -[ROClientChannel dispatch:] + 279
> 	5   AppServerTestMac                    0x00000001000725ba -[LoginService_Proxy GetAPIVersion] + 314
> 	6   AppServerTestMac                    0x00000001000bcaa6 $s16AppServerTestMac11ContentViewV7DoLoginyyF + 1174
> 	7   AppServerTestMac                    0x00000001000bc609 $s16AppServerTestMac11ContentViewV4bodyQrvg7SwiftUI05TupleF0VyAE4TextV_AE6ButtonVyAIGtGyXEfU_yycfU_ + 9
> 	8   SwiftUI                             0x00007fff43a1d2e9 $s7SwiftUI33PrimitiveButtonStyleConfigurationV7triggeryyF + 25
> 	9   SwiftUI                             0x00007fff43e4e2c0 $s7SwiftUI33PrimitiveButtonStyleConfigurationV7triggeryyFTA + 16
> 	10  SwiftUI                             0x00007fff43e4dfb9 $s7SwiftUI11Coordinator33_9FEBA96B0BC70E1682E82D239F242E73LLC14didPressButtonyySo8NSButtonCF + 25
> 	11  SwiftUI                             0x00007fff43e4dff6 $s7SwiftUI11Coordinator33_9FEBA96B0BC70E1682E82D239F242E73LLC14didPressButtonyySo8NSButtonCFTo + 38
> 	12  AppKit                              0x00007fff340ac018 -[NSApplication(NSResponder) sendAction:to:from:] + 299
> 	13  AppKit                              0x00007fff340abeb4 -[NSControl sendAction:to:] + 86
> 	14  AppKit                              0x00007fff340abde6 __26-[NSCell _sendActionFrom:]_block_invoke + 136
> 	15  AppKit                              0x00007fff340abce8 -[NSCell _sendActionFrom:] + 171
> 	16  AppKit                              0x00007fff340abc2f -[NSButtonCell _sendActionFrom:] + 96
> 	17  AppKit                              0x00007fff340a7ecd NSControlTrackMouse + 1745
> 	18  AppKit                              0x00007fff340a77d4 -[NSCell trackMouse:inRect:ofView:untilMouseUp:] + 130
> 	19  AppKit                              0x00007fff340a7694 -[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 691
> 	20  AppKit                              0x00007fff340a6a13 -[NSControl mouseDown:] + 748
> 	21  AppKit                              0x00007fff340a4ded -[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:] + 4907
> 	22  AppKit                              0x00007fff3400ef3c -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 2612
> 	23  AppKit                              0x00007fff3400e2e5 -[NSWindow(NSEventRouting) sendEvent:] + 349
> 	24  AppKit                              0x00007fff3400c65c -[NSApplication(NSEvent) sendEvent:] + 352
> 	25  AppKit                              0x00007fff33e583df -[NSApplication run] + 707
> 	26  AppKit                              0x00007fff33e2a775 NSApplicationMain + 777
> 	27  AppServerTestMac                    0x00000001000bf26d main + 13
> 	28  libdyld.dylib                       0x00007fff6e3c77fd start + 1
> 	29  ???                                 0x0000000000000003 0x0 + 3
> )

That’s curious. If you so a regular NRURLSession request to that URL form code, that that work? Are you 100% sure the URL in the app is correct?

The url was correct but I was getting a null url object when instantiating with a string url so when tried it as you suggested I got the same error. I am glad you pointed me in the right direction. Thank you! After tweaking another test project I got it to work. This particular project still doesn’t work for some unknown reason, even without RemObjects in the mix.

How do you instantiate a JSON message from Xcode? I couldn’t find it in the source code.

Curious. can you share the exact URL? does it contain any “unexpected” characters that maybe need URL-encoding?

It seems that we currently only support Bin and Json message from Cocoa. I’d really recommend using BinMessage, anyways (Json is a fallback for interior with non-RO clients mainly)

http://192.168.1.4:8099/bin

Did you mean SOAP message? One thing we struggle with the bin message is server compatibility. With JSON we could make the message flexible so if the api object properties didn’t quite match (i.e due to the client updating from the app store but not the server) things could still work. Do you have a workaround for this?

Hmm, that looks fine. some,y creating an NSURL from that fails, you say?

Yes, sorry. brainfart ;). I meant we only support Bin and SOAP on Cocoa, right now.

I see, yeah. you would want to use versioning for that. We have on our list to add more explicit/integrated versioning support, but for now, the bets option would be to create descendant classes of the structs you pass round (say MyStructV3 etc) that descend from each-other, and have an API (say during login) where the client can send a version number, so that the server can fall back gracefully to sending older versions of the struct.

I’ll see of we can give prio to proper RODL-integrated versioning support in the new year.

Yes, I had to specifically encode it as a UTF8 string for it to create a proper URL.

Where is JSON support at on the schedule?

What is your vision of proper versioning? Can you share details?

That’s strange. can I see you code? Since that Url has no special non-latin characters, it should be fine as is…

TBH we have. o plans to add it right now since, as I mentioned, Json support is mainly there for non-RO clients to be able too access RO servers, and RO-native clients should use Bin for optimal performance.

It’s still at the drawing board stage, I’m afraid, not much to share on this yet. That said, I’d appreciate your feedback to what your versioning needs are — mainly adding new fields to structs? new parameters to methods? new methods to services? changing existing signatures?

All of the above.

That would be the icing on the cake.

When do you hope to make this available? Q2? Q3?

I don’t wanna make promises, but ideally late Q1 or in Q2, I’d expect/hope.

1 Like

Thanks, logged as bugs://83718

Even using the native components I couldn’t get the macOS app to communicate with that url. I got the native components and RO working (individually) in the iOS simulator.

So it can be expected that an older server can talk to a newer client with the new versioning system? Without inheritance?

I can;'t say what the exact mechanism for this would be yet, but yes, that’d the the ideal outcome.

It would probably bot be compatible with pre-versioning clients, but once the client uses the versioning-supporting bin format, I’d expect both client and server would be able to receive different (including older and unexpected/newer) versions of the same structs, and cope with that accordingly (either automatically, or optionally with intervention from user code)

1 Like