Search Unity

How to open Mac Build file after code sign

Discussion in 'macOS' started by methos5k, Feb 2, 2017.

  1. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    I have tried to search for this a lot, and found many similar issues but nothing that solved my problem.

    My issue is that when I build an app for the Mac app store (with the appropriate provisioning profile) to send for review, I can't seem to find a way to sign the app with my development provisioning profile and open the app.

    I would love to know how to do this for a few reasons:
    - allow testing installation.
    - allow testing that the game center (or other services) are working correctly.

    I can run my game, minus services such as Game Center, currently.
    I can also code sign and submit my app, which appears to work on the reviewers computer (my last builds had some play errors that I've since resolved, but it wasn't reported that it can't open).

    The app store validation code sign distribution profile only works if you get the app from the app store (I believe), but I've read that there is a way to test the development one.
    I am certain that this was possible with Xcode (not unity related, but some previous app building experience), that a development build could do this.

    To sum up, I have an app I've made in Unity, but when I sign it with a development profile, the app doesn't load. From what I can gather, no helpful information is in the Console app. Just codesign error .
    Any tips/resolutions would be greatly appreciated =)
     
    zhassan likes this.
  2. mark_ffrench

    mark_ffrench

    Joined:
    May 26, 2014
    Posts:
    12
    This is a tricky issue, and particularly in the case of Developer ID builds, has always been quite hard for me to get my head around. But I'll see if I can help you out.

    You have two profile types, Developer ID and Distribution. As you said, builds signed for Distribution will only work if they've been downloaded from the App Store.

    It's my understanding that Mac App Store Apps have to have some sort of receipt validation code on startup. Unity takes care of this for you with the Mac App Store Validation option which can be found in the editor, under Build settings for desktop builds.

    When a user downloads an app from the app store (even if it is free) they will receive a receipt that gets stored locally on their mac. It is specific to the app, to that version number of the app, and specific to the iCloud user they used to log in to the app store. If the receipt is missing you'll usually see an "Application is damaged" error, and if the receipt is present but not valid, unity's own receipt validation will close the app.

    If you codesign using a Developer ID profile, or run the app without any codesigning, receipt validation will always fail, kicking you out of the app. So make sure that the option is disable before exporting.

    Once you've exported a build you'll need to sign the app with your Developer ID provisioning profile, then build the pkg file (I'm not actually sure if you need to use the DevID or live installer profile for this, I seem to be using the live).

    Installing the pkg file should, in theory, install the app in the /Applications folder. However, there are a couple of other possible issues that you might encounter:

    If OSX already thinks you have a copy of your app anywhere on your mac, it will install your new version over it. This could be anywhere on your hard drive, so make sure that the app you are trying to run after installation is the one that has actually been updated by the installer. Your best bet is to try track down all copies of your app and delete them.

    OSX can sometimes get completely confused about what apps are installed and what receipts you have. If all else fails, try downloading Onyx.
    Run it and select "cleaning", make sure "delete the cache: Boot" is ticked and then execute. This should clear up and weird local cache issues.

    Hope something in this wall of text helps!
     
  3. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    That was a great response. You said a lot that was true, about it installing where it finds your app, if you already have it installed and about how to code sign.
    The part about getting it done right for the app store, is something I have working. The part I'm curious to learn is how do I get a developer copy of this game on my local machine (without downloading it from the app store). I can use the Unity build copy without the receipt, but that does not grant me access to the service functions of the app, as far as I can tell.
    Services, like Game Center.
    Is there any special signing that must be done to allow a 'test' build to access these features?
     
  4. mark_ffrench

    mark_ffrench

    Joined:
    May 26, 2014
    Posts:
    12
    I've not tested Game Center, but when we were testing payments we were able to do so on a Developer ID signed build using sandbox users. However, from the looks of this doc, that feature may have been deprecated now.

    That said, I'm pretty sure you can install a real "App Store" build on your machine without it having come from the app store directly. You wouldn't be able to do payments, but from what that doc suggests, you probably would have access to game center services?

    I would recommend trying the onyx clean trick if you haven't already. Our QA guys find themselves having to do that on regular basis when we're testing new mac builds for the store.
     
  5. mark_ffrench

    mark_ffrench

    Joined:
    May 26, 2014
    Posts:
    12
    It might also be worth opening the OSX console and checking what error code the App Store build throws when you try to run it.
     
  6. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    I appreciate your feedback. Perhaps it wasn't all cleaned up. I haven't tried it, again, because it's no big deal for that app. It must have worked for the app reviewer, because it was put up in the store.
    Hopefully I will figure it out for future builds (and/or Unity does get the option for projects to go to xcode, where I know it's worked before).
    Thanks again for trying to help and your suggestions.



    I
     
  7. elpuerco63

    elpuerco63

    Joined:
    Jun 26, 2014
    Posts:
    271
    Hi, I am trying to sign the Mac OSX file exported by Unity and am finding this troublesome?

    I first tried using the Unity Entitlements Tool which although reported all was well does not seem to sign the app?

    I then found your post and have tried to create an installer package using http://s.sudre.free.fr/Software/Packages/about.html but I cant see how to sign the app and even though I can create and installer and run it I can find why it supposedly installs too?

    Basically I need to sign my app as a known developer for non app store installing