So I think I have found the reason for this difference in behavior on various hardware platforms. It has to do with a System Setting found in the Keyboard settings section named: Keyboard Navigation.
if it is enabled then the program works as expected and if it is disabled then the program doesn't work as expected. In my case, for some reason, my Mac Studio desktop had this setting enabled (so it worked); my MacBook pro had the setting disabled (so it didn't work). When I enabled on MBP it worked; when I disabled on Mac Studio it stopped working.
Post
Replies
Boosts
Views
Activity
yes; I did get that error and changed the initial value to 1;
when you ran on mac mini did it work properly (like my desktop) or not (like MacBook pro)?
I made a few other changes to the code also (to display the hardware name, etc); updated code for Content View: (not sure how to edit original post)
enum FFocus: Hashable {
case pkNames
case btnAssign
case tfValue
case btn1
case btn2
case noFocus
}
struct PZParm: Identifiable {
var id = 0
var name = ""
}
struct ContentView: View {
@State var psel:Int = 0
@State var tfVal = "Testing"
@State var hw = ""
@FocusState var hwFocus:FFocus?
var body: some View {
VStack {
Text("Hardware test on " + hw).font(.title2)
PPDefView(bSel: $psel)
.focused($hwFocus, equals: .pkNames)
TextField("testing", text:$tfVal)
.frame(width: 400)
.focused($hwFocus, equals: .tfValue)
HStack {
Button("Button1", action: {})
.frame(width: 150)
.focused($hwFocus, equals: .btn1)
Button("Button2", action: {
tfVal = ""
hwFocus = .tfValue
})
.frame(width: 150)
.focused($hwFocus, equals: .btn2)
Button("New", action: {
tfVal = ""
psel = 0
hwFocus = .pkNames
})
.frame(width: 150)
.focused($hwFocus, equals: .btnAssign)
}
}
.padding()
// handle picker change
.onChange(of: psel, {
if psel > 0 {hwFocus = .tfValue}
})
.onAppear(perform: {
hw = hwn()
hwFocus = .pkNames}
)
}
// generate hardware model name
// using sysctlbyname
//
func hwn() -> String {
var len = 0
sysctlbyname("hw.model", nil, &len, nil, 0)
if len > 0 {
var rawName = Array<UInt8>(repeating: 0, count: len)
sysctlbyname("hw.model", &rawName, &len, nil, 0)
if let s = String(bytes: rawName, encoding: .utf8) {
return s
}
}
return "Unknown"
}
}
#Preview {
ContentView()
}
struct PPDefView: View {
@Binding var bSel:Int
// test defs
let pzparms:[PZParm] = [
PZParm.init(id:1, name:"Name1"),
PZParm.init(id:2, name:"Name2"),
PZParm.init(id:3, name:"Name3")
]
//
var body:some View {
Picker(selection: $bSel, label: Text("Name")) {
if bSel == 0 {
Text("no selection").tag(0)
}
ForEach(pzparms) {Text($0.name)}
}.frame(width: 250)
}
}
Never mind; when I added .frame to the table it displays.
When I repeatd the exact same process this afternoon (Saturday June 10) the Sonoma beta installed successfully.
This problem has plagued me for a bunch of years also. Recently I found the following "workaround":
I would get the error if the config file for the project had a URL of the form:
url = ssh:userid@//hostname/path-to-project
however if I remove the userid from this string then Xcode will prompt me for the userid/password:
url = ssh://hostname/path-to-project
This also will work for cloning the project from within Xcode, just enter the string:
ssh://hostname/path-to-project
It might cause problems with issuing git commands from a command shell because it will use the current userid added to the string.
problem seems to be fixed now. Can download.
reported same problem trying to download Xcode 13 beta 5
thanks for the response! I did get it to work after adding a few more constraints - the main one being a trailing constraint on the bordered scroll view (containing the table view).
I tried a solution similar to that outlined by mattie; when logged in as the userid that shows the -1 error I edited a project's .git/config file and replaced the hostname for the "remote" server with its ip address (for me this was easy because the git server is in the same local network as my development machines). When I then opened the project in Xcode the git repository functions worked without errors. I then edited the config file again and changed the ip address back to the hostname and the Xcode git functions still worked!
I've had some success using the notes provided by guyton (thank you). I have 2 machines which were both exhibiting this problem. I followed the same procedure on both:
created key pair and exported the public key to the remote server successfully
verified that I can access remote using command line git clone
With Xcode not running:
(1) delete the IDESourceControlKnownSSHHostsDefaultsKey using defaults utility:
defaults delete com.apple.dt.xcode IDESourceControlKnownSSHHostsDefaultsKey
(2) REBOOT machine
(3) start Xcode and attempt to clone a project
On one machine this worked perfectly - Xcode showed the dialog for picking ssh key pair to use and then cloned the remote project as expected. All other projects again allow remote push, pull, etc.
However on the other machine, I still get the -1 error. I suspect it has something to do with ssh environment but do not really know how to troubleshoot the problem. Any suggestions would be appreciated.
I also tried with deleting the entire plist from preferences and rebooting but that also did not fix the problem.
One last thing I did was to create (on the machine that has the problem) a new user account. In that account:
create rsa key pair
export public key to server
start Xcode and clone project - this worked without any problems
I've had some success using the notes provided by guyton. I have 2 machines which were both exhibiting this problem. I followed the same procedure on both:
created key pair and exported the public key to the remote server successfully
verified that I can access remote using command line git clone
With Xcode not running:
(1) delete the IDESourceControlKnownSSHHostsDefaultsKey using defaults utility:
defaults delete com.apple.dt.xcode IDESourceControlKnownSSHHostsDefaultsKey
(2) REBOOT machine
(3) start Xcode and attempt to clone a project
On one machine this worked perfectly - Xcode showed the dialog for picking ssh key pair to use and then cloned the remote project as expected. All other projects again allow remote push, pull, etc.
However on the other machine, I still get the -1 error. I suspect it has something to do with ssh environment but do not really know how to troubleshoot the problem. Any suggestions would be appreciated.
Still have problem with recently released Xcode 12.3
problem still occurs with Xcode 12.1;
I tried fix suggested by curtly42 (changing default branch name to master) but this had no effect on the problem for me.
to ehmjaysee: can you elaborate on what you did? What area of the Xcode preferences are you referring to? Not sure where to look for source control account information in the preferences (it's not in the source control general or git)?
thanks for any help
Just an update; I was able to access a machine with Xcode 11 and performed the suggestions (copy class code from Xcode 11 and then disable ML Class code generation); it did build without error messages and worked properly.
However this still seems to me to be a bug in the Xcode 12 compiler for it to generate class wrapper code that has errors.