I have an m1 mac. And I’m trying to create a watch target for my iOS app. After numerous tries, I’ve not been able to run to any watch (either real or simulator).
I also downloaded open source watchOS projects and couldn’t run any of them. I get the error “Could not attach to pid: 18362” “attach failed ((os/kern) invalid argument)
Has anybody faced this challenge? How did they fix it? Is it caused by the m1, cos I was able to create it on another Mac
4
Answers
Found out the hard way.
As of March 2021, the new Mac M1s cannot run WatchKit apps and CarPlay apps. You either end up with the error in the question or another error.
But these errors do not pop up on regular macs.
Had a similar issue with playground / xcode projects.
When opening the playground the issue appears like this
The Solution for me was to activate the "Rosetta Mode" when having a xcode project and deactivate the "Rosetta Mode" when using the playground.
You can activate / deactivate it by searching for Xcode in your finder (cmd+space, type "Xcode" scroll below and found it) do a right click an click on "Get info" and in the "General" tab you use the "Open using Rosetta" -button.
Maybe this is also a solution for your problem.
Try to uncheck the open with rosetta option for xcode. For me it was working perfectly in my m1 mac book air.
For building I enable rosetta, otherwise build process fails.
Then if you to launch the build on watch it debugger fails to attach to debugger (same error as above).
Then go and disable Rosetta and then launch watch build once again. It works. Hopefully it helps