21

Recently, I wasn't able to run some of my apps in Xcode. They would build, then quit without showing up. So I tried going into the Debug folder and starting the app manually. I ended up getting an error report from macOS telling me that the exception type was "Code signature invalid". I also ran a test in Xcode and it told me that the code wasn't signed at all, and that it failed with exit code 1. I know that something must be wrong with my code signing in my Xcode projects, but I'm not sure how to fix this. It's affecting both applications that I have on the Mac App Store, so I'm guessing it has to do with certificates. Please let me know how I could fix this. I'm making a macOS app with Xcode 8. I desperately need this error fixed so if you have any ideas please post them and if they work I will promptly award you the +50 rep. Thanks!

Here is a screenshot of the error I'm getting on one of the projects.

Error Screenshot here

TDM
  • 814
  • 2
  • 12
  • 21
  • Thanks for the comment. I tried all the answers on that page, and none of them fixed it. I will also add that I'm getting a new error that says "Module file's minimum deployment target is OS X v10.12" What's weird is that in build settings and the general settings I've set the deployment target to macOS 10.12... Maybe that should be a separate question, but do you think that could have something to do with it @Guru? – TDM Oct 18 '16 at 17:28

5 Answers5

28

You should try cleaning your project (CMD + SHIFT + K), it worked for me.

karolsenami
  • 289
  • 3
  • 4
17

try this, this solved mine iPhone Settings -> General -> Device Management and choose to trust your company

linh
  • 171
  • 1
  • 2
1

Strangely enough, the update to Xcode 8.1 fixed it! So the moral of the story is: try updating if an update is available and see if that fixes any code signing problems!

Thanks everyone for your helpful answers. I'm sure they'll solve someone's problem.

TDM
  • 814
  • 2
  • 12
  • 21
  • still struggling for the similar problem and it is not fixed by re-installing Xcode.. (because I am using the latest version) Any other suggestion? As you mentioned, I have tried 'basic things'. – klados Oct 07 '18 at 17:47
  • Sometimes iOS update for iPhone device appears faster than an update for Xcode. – J A S K I E R Feb 14 '20 at 13:28
0

There have been problems in the past with having spaces in names and paths. I would suggest removing the space form the app name and see if that effects anything.

Also is your test target signed?

drekka
  • 20,957
  • 14
  • 79
  • 135
  • Thanks for your reply. So where would I remove the space in the app name from? A directory, file, or folder? Something else? And I'm not sure how to see if my target is signed. I'm not sure if it is, since it's a code signing issue. If you could update your answer with those specifications and let me know that you've done so I'd appreciate it! – TDM Oct 21 '16 at 01:10
  • I think the test target is signed, because I just corrected an error there, and it's not giving me any more trouble as far as the Instruments Quiz.xctest goes. But I'm still having a code signing issue of some kind. – TDM Oct 21 '16 at 01:27
  • Also it's unable to load the library. – TDM Oct 21 '16 at 21:34
0

Experienced the same issue, what helped for me was this:

Open finder and show the project package contents, and open the following file with Xcode:

project.pbxproj

Search for: PROVISIONING_PROFILE_SPECIFIER

And comment it out for both the debug & release section:

/*PROVISIONING_PROFILE_SPECIFIER = "";*/
Jos
  • 1
  • Thanks for your answer! So I did what you said, and it didn't change anything. Also, there was no Debug or Release sections in the file, just one match for PROVISIONING_PROFILE_SPECIFIER. Any suggestions? Since it's affecting both apps that are registered in iTunes Connect, I'm wondering if it's a certificate issue. Any thoughts? Thanks! – TDM Oct 23 '16 at 03:15
  • I think its a conflict between manually and automatic created provisioning profiles. Before I commented out these lines I also removed all manually created provisioning profiles in the Mac Dev portal. Automatic signing should be enabled in the project. – Jos Oct 23 '16 at 05:17
  • Ever since installing Xcode 8 it has automatically been managing signing. I went and deleted the one automatically created invalid provisioning profile in iTunes connect. I also went through my project to make sure there weren't any conflicting settings, and everything seems correct. However, one interesting thing i noticed was that on the General tab of my app's target under Provisioning Profile, it says "None Required". So that must mean that it's not dealing with provisioning profiles. I have deleted all duplicate certificates and made sure they're all up to date. Still not working. – TDM Oct 23 '16 at 15:58
  • Thats the opposite of what I had .... the none required App was working whilst the App with a provisioning profile was not. Double check if your team ID is the correct and delete all manually created certificates and profiles .... – Jos Oct 24 '16 at 17:55
  • I tried all that, and also deleted the Mac Developer certificate from Keychain Access and let Xcode automatically reinstall it. Still not working. Both apps are unable to load libraries as well - and I'm not using any additional frameworks. – TDM Oct 25 '16 at 02:52
  • If you're able to give me an answer fixes my problem sometime in the next 20 hours, I'll award the +50 rep to you! You've been very helpful and dedicated to helping me @Jos and I appreciate that :-) – TDM Oct 25 '16 at 19:59