Post

Replies

Boosts

Views

Activity

Reply to Not a valid path to an executable file.
I too got this error when I reorganized, and renamed, project directories. Evidently I did not do that right, if there is a way to do it at all. If there is not, there should be one made. This is the error I got: Executable Path is a Directory Domain: DVTMachOErrorDomain Code: 5 Recovery Suggestion: /Users/spflanze/Library/Developer/Xcode/DerivedData/Bonjour-Trial-iPhone-fotboannvetiniedscmjlgfnqmmh/Build/Products/Debug-iphonesimulator/Bonjour-trial-iPhone.app is not a valid path to an executable file. User Info: { DVTErrorCreationDateKey = "2023-05-18 16:11:29 +0000"; } -- System Information macOS Version 13.3.1 (a) (Build 22E772610a) Xcode 14.3 (21812) (Build 14E222b) Timestamp: 2023-05-18T09:11:29-07:00 I do not know how to fix this project. I have come to the conclusion I will have to start again with a newly made project file, and copy my source code from the failed project into the new one.
May ’23
Reply to Displaying a Set in a View
Thank you for your reply. In my case what needs to be enumerated are four iPhones connected to a MacStudio by means of Lightning Cable. I am attempting to enumerate these to establish communications with software also written by me in the iPhones. I did the conversion you recommended. But when I attempt to use my equivalent of your "newResultsArray" in a View's ForEach statement I find that something is lost in the conversion. When I attempt to use my equivalent, which in my code is the results member of the SSH_Browser class (code below), I get an error in the View. What was lost? What needs to be done to get the print function to accept it? The code, and the error message in comments: struct ContentView: View { @StateObject var sshBrowser = SSH_Browser() var body: some View { VStack { ForEach( sshBrowser.results, id:\.hashValue ) { result in print("result ", result ) // Red underline under the first character of "print(...". The error: "No exact matches in reference to static method 'buildExpression'" } } .padding() } } class SSH_Browser: ObservableObject { var browser: NWBrowser! @Published var results: [NWBrowser.Result] = [] init() { let bonjourTCP = NWBrowser.Descriptor.bonjour(type: "_ssh._tcp" , domain: nil) let bonjourParms = NWParameters.init() browser = NWBrowser(for: bonjourTCP, using: bonjourParms) // This change event handler code executes when available devices change. browser.browseResultsChangedHandler = { ( results, changes ) in for result in results { print("result ", result ) // No error here. The "result" Set element is accepted. if case .service(let service) = result.endpoint { print("bonjourA ", service.name) } } self.results = Array( results ) // Something is lost here, for when used in the View the print() function does not accept the self.results array elements. } browser.start(queue: DispatchQueue.main) } }
May ’23
Reply to Creating a missing Info.plist file
Never mind. I found out that as of Xcode 13 the Info.plist file is no longer automatically generated, and are now optional. I wanted to edit this file because there was a key value pair I needed to add. I found I can click on the project in the "Project navigator", and add this in the project's "Build Settings" tab by clicking on the + sign to the upper left.
May ’23
Reply to Interaction between iPhone and Mac/PC via USB - How?
I have an error when I try to do this. My code is based on eskimo's. My version of it is: import Foundation import Network class SSH_Session: ObservableObject{ public private(set) var listener: NWListener? = nil public private(set) var ButtonText: String = "" @Published public private(set) var isListening: Bool = false init(){ setButtonText( false ) } public func start(){ print("listener will start") listener = (try? NWListener(using: .tcp) ) ?? nil if (listener == nil) { print( "Failed listener acquisition." ) setButtonText( false ) }else { listener?.stateUpdateHandler = { newState in print("listener did change state, new: \(newState)", "" ) if( (self.listener?.debugDescription != nil) && (self.listener?.debugDescription != "") ) { print( " " + self.listener!.debugDescription ) }else{ print( "\n" ) } } listener?.service = .init(type: "_ssh._tcp") listener?.newConnectionHandler = { connection in let remotePeer = connection.currentPath?.remoteEndpoint print("listener rejected a receive connection, from: \(remotePeer as Optional)") connection.cancel() } listener?.start(queue: .main) setButtonText( true ) } return } public func stop() { print("listener will stop") self.listener?.stateUpdateHandler = nil self.listener?.cancel() setButtonText( false ) } public func StartStop() { if( self.isListening ) { self.stop() } else { self.start() } } private func setButtonText( _ isListening: Bool ) { self.isListening = isListening ButtonText = isListening ? "Close SSH Connection" : "Open SSH Connection" } } In my version of stateUpdateHandler I included a verbose diagnostic. Xcode is installed in the iPhone 14, and it is in developer mode. I turned off Bluetooth, WiFi, and cell service even though it is not connected to a cell service. Info.plist is not automatically added to a project since Xcode 13. I am using Xcode 14.3. When the project was created I did not know to add one. So I used the properties GUI. In the "Build Settings" tab I added the key value pair shown in this screenshot: The screenshot includes the error I got. I copy and paste its text here: listener will start listener did change state, new: ready [L1 failed, local endpoint: <NULL>, parameters: tcp, local: ::.49728, definite, attribution: developer, server, port: 49728, path satisfied (Path is satisfied), interface: en0[802.11], ipv4, dns, service: <NULL>._ssh._tcp.<NULL> txtLength:0] listener did change state, new: failed(-65555: NoAuth) [L1 failed, local endpoint: <NULL>, parameters: tcp, local: ::.49728, definite, attribution: developer, server, port: 49728, path satisfied (Path is satisfied), interface: en0[802.11], ipv4, dns, service: <NULL>._ssh._tcp.<NULL> txtLength:0] The terminal program in the MacStudio does not show any SSH servers are available iPhone. The iPhone's SSH service appears not to be advertised. I do not know what to do about this error. Any suggestions would be appreciated.
May ’23
Reply to Interaction between iPhone and Mac/PC via USB - How?
The delete key removed the Terminal's "New Remote Connection" list in the Build Settings tab. I added the Info.plist file by adding a key value pair I did find a way to add. This was in "URL Types". As soon as I added this an Info.plist file appeared in the project. I then removed the URL type I added. I then edited the newly created Info.plist file to add the key, value, pair: "Bonjour services", "_ssh._tcp" to it. This worked in the iPhone 14 simulator running in the MacStudio. The MacStudio did show up in Terminal's "New Remote Connection" list. But when the program was downloaded into a real iPhone 14 over a lightning cable I still got the 65555 NoAuth error, and the real iPhone 14 did not appear in the Terminal's "New Remote Connection" list. It is as if the key, value, pair: "Bonjour services", "_ssh._tcp" in the Info.plist file did not make it into the real iPhone 14. This screen shot shows the setup:
May ’23
Reply to Interaction between iPhone and Mac/PC via USB - How?
I changed the listener initialization line to: listener?.service = .init(name: "iPhone1", type: "_ssh._tcp", domain: "BRDF" ) That got rid of of the NoAuth error. The message I get now is: listener will start listener did change state, new: ready [L1 ready, local endpoint: <NULL>, parameters: tcp, local: ::.62862, definite, attribution: developer, server, port: 62862, path satisfied (Path is satisfied), interface: en0[802.11], ipv4, dns, service: iPhone1._ssh._tcp.BRDF txtLength:0] But advertisement still fails. It does not show up as a server in the Terminal program. The message shows local endpoint is still: . Could that have something to do with it? Is there a tutorial somewhere about how to do this by using Bluetooth instead of the Lighting Cable USB? Plan B is to use Bluetooth.
May ’23
Reply to Phantom Service
I found the answer to this in Question #4 no this webpage: https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/NetServices/Articles/faq.html 4. When I disconnect a device from a network, does it remain visible? Yes, for a while. Eventually, the DNS record reaches its time-to-live interval and disappears. As an app developer, if you connect to a host using Bonjour and the connection fails, you can ask the Bonjour to reconfirm the record. This process is described further in NSNetServices and CFNetServices Programming Guide. What I saw as phantom were the remaining DNS records. They eventually disappeared as their TTL (Time To Live) expired.
Jun ’23
Reply to Reconfirming the DNS the Record
Is there no way then to tell the high level functions to reconfirm, or cause Bonjour to handle this for me in any way when it has failed to and I need it to? Are the functions used in the TicTacToe example high level? Suppose a host that has advertised its service goes offline. If it comes back online before its DNS record's TTL expires should that record remain a valid one that can be used to connect with? In systems where IP addresses are dynamically allocated will the DNS record remain valid if the IP address for the DNS record's host device has changed? Does a host that has advertised a service have a means of erasing its DNS record in the WiFi router? When the host advertises can it set the TTL time?
Jun ’23
Reply to case keyword used without switch
So if "browseResult.enpoint" is equal the value returned by the method call to " NWEndpoint.service(name: name, type: _, domain: _, interface: _)" the variable "title" is set equal to "Join (name)". I am accustomed to "==" being used for a Boolean equality test, and "=" being used to change value of something. Why does Swift break with that tradition from C, and C++, here? Another point of confusion for me are the underlined characters used as parameter values in the method call. What does that mean? Does it mean default values are to be used? And what of if let browseResult = browseResult, ? Does this test whether "browseResult" has a nil value?
Jun ’23
Reply to case keyword used without switch
I see now that NWEndpoint is not a class, or struct, and .service is not a method. NWEndpoint is an enumeration defined in the file Network.h, and that .service is a case element in the NWEndpoint struct. Now I can see the pattern matching. It is testing whether the name is the same in both NWEndpoint.service, and browseResult.endpoint. Thanks everyone for your help.
Jun ’23
Reply to Controlling F-Stop, exposure time, and zoom level, in Swift
I found out that iPhone camera hardware has a fixed aperture. No hardware to adjust its aperture exists. As far as exposure time goes I found out that information here: https://developer.apple.com/documentation/avfoundation/avcapturedevice/1624646-setexposuremodecustom And the camera functions have to be locked to do these by using the methods: .lockForConfiguration() .unlockForConfiguration()
Jun ’23
Reply to Accessing Interface Builder GUI Controls Anywhere in the App
I found my answer here: https://help.apple.com/xcode/mac/current/#/devc06f7ee11 There are at least two ways to do it. The simplest way takes more memory, but it is quick and easy. This is to put an outlet in the class that defines the view the switch is in. The outlet is placed there in the same way the handler method is, namely by control dragging the switch from the Storyboard into its class's code shown in the Assistant. In the dialog that appears when the switch is dropped into the code, instead of selecting "Action" select "Outlet", and enter a variable name. The result will be a line of code of the form: @IBOutlet weak var mySwitch: UISwitch! Where in place of "mySwitch" will be the variable name entered into the dialog box, and the class member name the switch's state can be accessed by.
Jun ’23