Post

Replies

Boosts

Views

Activity

NWConnection Timeout
I am using Apples Network framework to build a TCP connection to a server. It locks like this: testConnection.stateUpdateHandler = ({ state in 				print("TCP state change to: \(state)") 				switch state { 				case .setup: 						break 				case .waiting(let error): 						print("Waiting Error \(error)") 						testConnection.cancel() 						break 				case .preparing: 						break 				case .ready: 						beginCommunication() 						break 				case .failed(let error): 						print("\(error)") 						break 				case .cancelled: 						break 				default: 						break 				} 		}) The serverAddress and serverPort is entered by the user. I want to test the connection. Now my problem is, that if the user is entering an invalid address / port combination (the service is not offered by the server). I stuck in the preparing state for quite a long time. After that I get to the waiting stage (with error message POSIXErrorCode: Operation timed out). Is there any way to set the timeout for this first connection process ? Thanks for your ideas
5
0
4k
Sep ’20
showBluetoothAccessoryPicker does not show up
I made up my own iAP2-BT-device, which is perfectly running by use the BT-list and the External Accessory Framework. Now, following the instruction for MFI developers, I would like to show the showBluetoothAccessoryPicker using the following swift code: EAAccessoryManager.shared().showBluetoothAccessoryPicker(withNameFilter: nil) { (error) in             if let error = error {                 switch error {                 case EABluetoothAccessoryPickerError.alreadyConnected:                     break                 default:                     break                 }             }         } Wherever I put this snipple in my app code the picker is never shown (device unpaired by "forget device") and I always get the console message: A constraint factory method was passed a nil layout anchor.  This is not allowed, and may cause confusing exceptions. Break on BOOL _NSLayoutConstraintToNilAnchor(void) to debug.  This will be logged only once.  This may break in the future. I have no idea what to do to get this picker shown ... Thanks for your help
4
1
2.6k
Sep ’20