Search Unity

Codesign no longer working.

Discussion in 'macOS' started by arkon, Oct 29, 2018.

  1. arkon

    arkon

    Joined:
    Jun 27, 2011
    Posts:
    1,122
    Ok, getting mighty frustrating. Just tested and released 2 games back to the OSX mac app store and all worked fine. Just tried the exact same procedure on a 3rd game and it crashes immediately when you try and run it with a EXC_CRASH (Code Signature Invalid).

    The games have a store build in and I need to test them on the desktop prior to uploading with application loader. So I unity2017 build a MacOS target with Mac store validation set TRUE. I then do the following in terminal as per the instructions:

    chmod -R a+xr "/myapps/ios/Unity5/GameName/GameName/GameName.app"

    codesign -f --deep -s '3rd Party Mac Developer Application: MyCompanyCerts' --entitlements "/GameName.entitlements" "/myapps/ios/Unity5/GameName/GameNameGameName.app"

    I get no errors and the app is signed ok. When I run the .app it crashes immediately with this log:

    Code (CSharp):
    1. System Integrity Protection: enabled
    2.  
    3. Crashed Thread:        0
    4.  
    5. Exception Type:        EXC_CRASH (Code Signature Invalid)
    6. Exception Codes:       0x0000000000000000, 0x0000000000000000
    7. Exception Note:        EXC_CORPSE_NOTIFY
    8.  
    9. Termination Reason:    Namespace CODESIGNING, Code 0x1
    10.  
    All provisioning profiles are correct as are my certificates as proven by the last 2 apps I just did days ago using this exact same procedure. Normally the game will run and the store lets me purchase in sandbox mode to test the game.

    Any ideas Unity team?
     
    Xander-Davis likes this.
  2. arkon

    arkon

    Joined:
    Jun 27, 2011
    Posts:
    1,122
    I found the cause! Just for anyone else that has the same problem, the reason was the entitlements file contained the key gamecentre and the profile didn’t. Just setting the key to NO didn’t cure it, you have to totally delete the key.
     
    Xander-Davis likes this.
  3. Xander-Davis

    Xander-Davis

    Joined:
    Apr 23, 2011
    Posts:
    441
    Is this related to this? I can't actually test after my apps are codesigned and packaged for upload because of the checkbox 'Mac App Store Validation' requiring Apple ID sign-in from presumably a customer that actually bought the app from the Mac App Store for real. So I don't know if they will crash because of GameKit or GameCenter and this is why we're also getting rejections from Apple citing GameKit. Is this related? https://forum.unity.com/threads/app...it-framework-reject-by-apple-reviewer.542306/
     
  4. akeplinger

    akeplinger

    Joined:
    Oct 26, 2008
    Posts:
    57
    After I codesign my Mac app it will no longer run at all. Adding entitlements does produce the CRASH previously reported, but with vanilla entitlements (com.apple.security.app-sandbox and com.apple.security.automation.apple-events) will produce an app that just hangs.

    codesign -vvv --deep --strict "MYAPP.app"
    Shows the codesign is "valid" credentials

    spctl -vvv --assess --type exec --raw "MYAPP.app"
    <key>assessment:verdict</key> <false/>

    I think this is because something in the app is referring to something that requires another entitlement, maybe. Modifying my entitlements breaks the app worse.

    Going in circles. I was able to submit the app using Application Loader, but the app itself crashes when trying to start up. Digitally signing was a multi-day adventure by itself.
     
  5. akeplinger

    akeplinger

    Joined:
    Oct 26, 2008
    Posts:
    57
    (Addendum)
    I kept trying different entitlements and I got the app to run if I added com.apple.security.cs.disable-executable-page-protection to the entitlements. I think that Apple with try to strip this out when delivering to the app store. I'll find out one way or another.