Reputation: 6922
I am unable to run my tests on my OSX app - the project builds fine but when I run Product -> Test in Xcode 8.2. It says :
Message from debugger: unable to attach
How do I get my tests working again?
Upvotes: 13
Views: 4404
Reputation: 1
My error was that I attempted to add an entitlement manually in the [app name].entitlements file. Deleting the added entry fixed the problem, You may have a corrupted ...entitlements file.
Upvotes: 0
Reputation: 1504
I had the same issue, but for the regular app. For some reason my app was sandboxed. You can check it selecting your Project/Target (your app) and then Capabilities, like in this screenshot (from Xcode 10 beta 4, but the concept should apply to older versions of Xcode):
App Sandbox was on. that also created a file "RSSReaderMac.entitlements". Which I probably messed up trying to keep the app sandboxed just to learn how it works. I disabled App Sandbox, trashed the entitlements file and then my app started running again.
Indeed the real cause was that my app actually crashes, with this error message:
Exception Type: EXC_CRASH (Code Signature Invalid)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
I suppose enabling the sandbox again the entitlements file gets recreated. Otherwise another option could be to check and clean that file first. But I didn't test it.
Upvotes: 0
Reputation: 5257
What solved the problem for me was to enable signing on the test target. You need to go to your project's settings, go to your target and in general, under Testing, you have the Signing section. Click on the big button "Enable signing" (or something like this). You may have to deal with provisioning profiles but it wasn't the case for me.
Upvotes: 5
Reputation: 6922
I ended up needing to "repot" my Xcode project using these steps which sorted it out. https://medium.com/@mobilebloke/xcode-8-going-slow-on-swift-3-have-you-tried-repotting-your-project-88d0066d2445#.idcdv2dd3
I know its not necessarily the fix but after trying:
Adding removing certs
Recreating profiles
Deleting and re-adding targets which didn't work...
this at least allowed me to continue
Upvotes: 0