I know many people do not develop for OSX due to the complexities,but after spending many hours implementing plugins and getting my game work correctly to Apple standards I was rejected for the following reason: “The app has the Game Center entitlement without linking against the GameKit framework”
I also noticed this change in older version of 4.6x
(none) - OSX: Now GameKit is loaded dynamically, it should help with Mac App Store submissions for games, which are not using Game Center.
Now it is mentioned by developer ** @jonas-echterhoff_1 ** “Unity 5 will automatically add or remove the GameKit linkage as needed if GameCenter if used or not”
I’m not sure what is going on, I’m using Unity 4.6.9 with Mac App Store Toolkit. I have got Game Center enabled in Entitlements as of course needed (using Prime31 plugin) Upgrading to Unity 5 is not a option(and I think it dont even work in Unity 5)
Can someone please tell me how to link against GameKit framework or a Unity hack.
Apple had changed the rules on this several times.
Originally we would always link against GameKit, regardless of the content using it or not.
Then, Apple started complaining about that, and enforce not linking to GameKit, unless you’d used it.
So what we did then is that we would never link to GameKit, and load it dynamically instead (This was the 4.6x release you mentioned).
Then, Apple started complaining about that as well, and enforce not linking GameKit when you would not use it, and enforce linking GameKit when you would use it.
This was more difficult to solve for us, because we don’t actually link the MacStandalonePlayer executable at player build time - we always use the same binary, and just changed the managed mono dlls. So what we had to do now, was to patch the binary to remove or install GameKit linkage depending on whether it is needed or not. This change is in Unity 5, which should work.
So, your options are now: Either update to Unity 5, or patch the binary yourself to add GameKit linkage. We are using optool to do that in the Unity 5 player build process, but we cannot provide any support for patching the binary yourself using optool.
Thanks for the detailed reply, much appreciated - clears up some stuff.
Maybe Apple once again changed there mind as it seems all the new iOS9 stuff etc has some impact, but who knows maybe its just the reviewer I got to check app being strict on me.
I cannot upgrade to Unity 5 because the game is complex and being build on 4.6 when Unity 5 came out. So cannot spend months more work on this. This is something I did not expect from Apple and assumed there would not be issues, cannot plan ahead for such things.
So seems optool my only option now, ok I check the internet to see if I can find a guide on how to do this as when I downloaded optool and opened in Xcode 7.1, OSX El Capitan could not run in Xcode. I just hope this thread gives bit more visibility as the old thread is abit messy and oftopic… Cheers.
Maybe you can take a shortcut, and download Unity 5, and uses the optool executable it uses, which should be at
/Applications/Unity/Unity.app/Contents/PlaybackEngines/MacStandaloneSupport/optool - saves you the trouble of finding out how to build it (which was a bit tricky, IIRC).
This should probably work (you can only tell for sure once it passes MAS submission, of course), please give it a try, and let us know if it works. If it does, we might consider integrating this as part of our build pipeline"
Now when I do run this, do I just normally build again in Unity and do nothing or have to run this against the Game.PKG which is generated for the Mac Store.
This command should still be valid. You need to replace <executable_path> with the executable inside the .app you build, and do this before packaging it up to a .pkg file.
Ah, was worried you may say this - but guess only way for now.
I use a tool called Mac App Store Toolkit (Unity Asset Store - The Best Assets for Game Making)
This enables user to enter all the App Certificates, Entitlements and many other things, and makes a Package file ready for upload, this does not have option for StoreKit but does link the Game Center correctly.
It can create a .App file without the packaging and then I can do the required edits in optool, but I guess no way I can transfer this back into Unity and make a package file, so will manually need to package it.
It can be done but that’s why I hoped Unity may have a solution to save time, but I understand Apple cannot make up there mind about this and hence not much discussion for long time… Its one those that keeps coming back once in a while issues.
Found FAT Header
Found thin header...
Found thin header...
Inserting a LC_LOAD_WEAK_DYLIB command for architecture: x86
Successfully inserted a LC_LOAD_WEAK_DYLIB command for x86
Inserting a LC_LOAD_WEAK_DYLIB command for architecture: x86_64
Successfully inserted a LC_LOAD_WEAK_DYLIB command for x86_64
Writing executable to /Users/Esquire/Desktop/MyGame.app/Contents/MacOS/MyGame...
Is this the expected result, do you remember?
UPDATE:
I get the following issue when uploading the .pkg file to Itunes, but I’m not sure if its to do with the tool or me packaging it.
Update: If I sign the App then edit it with optool does that invalidate the signature?
After many hours finally got the Invalid Signature error to go away. So I built OSX App withing Unity and then the .App edited it with optool, then I manually selected the .App within Unity using the Mac OSX Toolkit plugin, this then added the signature, entitlements and packaging. I then uploaded to the store and error was gone. So lets see what the review team come back with.
I hope the process is correct and does not override the changes done buy optool?
Thank you for all your help, Apple have accepted the game, so we know this process still works and optool is the one to use if anyone has similar issues. Cheers
Thanks for sharing this information guys. I just followed these instructions myself and optool appeared to work. Actually, optool was a pain to build so I was able to use the version included in Unity 5 as suggested. As of 5.3 it is located in /Applications/Unity/PlaybackEngines/MacStandaloneSupport/optool
In my game my apple app ID has game centre enabled, the game has game centre things in it, it uses calls to Social and the Prime31 game centre plugin, so why isn’t Unity linking in GameKit? OS x development is a right pain in the backside, so hit and miss. I wasted 2 weeks so far on something that should have just worked. It would probably better if Unity created an Xcode project same as IOS for OSX so we can at least tinker in Xcode to get things to work.
Looks like I too need to use optool. Can Unity please give us an answer on this, why is GameKit not linked in when I’m using all gambit stuff in the game? Oh I’m using Unity 5.3.3P1 on a mac.
Agreed. I never managed to get my app update approved - Apple came back with a different issue each time. After about 5 rejections I gave up - Mac App Store users are having to make do with a very old version for now. Definitely hoping Unity are able to improve this aspect of their software - OS X support is more trouble than it’s worth right now.
If you use GameKit through a plugin (ie, Prime31), it is possible that Unity will not detect that usage, and not add the GameKit linkage for you. Basically, Unity will scan your assemblies for references to the UnityEngine.SocialPlatforms.GameCenter.GameCenterPlatform class, and if it finds any, it will add the GameKit linkage. If you access the GameKit framework through other means, Unity cannot know about that, so you will either need to add a bogus reference to UnityEngine.SocialPlatforms.GameCenter.GameCenterPlatform, or add the GameKit linkage yourself using optool.
FYI, we have hired a new engineer to work on improving OS X support, and making an Xcode project you can edit is the current plan, AFAIK.
I use calls to Social and the GameKit isn’t being included so there is a bug in Unity. I’ve just had to strip all game centre stuff out of my game and generate new ID, profiles etc. then re submit. Here is my code and the Bug where Social.LoadUsers still doesn’t work.
void Start()
{
Social.localUser.Authenticate(ProcessAuthentication);
}
void ProcessAuthentication(bool success)
{
D.logx("ProcessAuthentication");
if(success)
{
D.logx("GameCentre Authenticated");
DoLeaderboard();
}
else
{
D.logx("GameCentre Failed to authenticate");
}
}
void DoLeaderboard()
{
D.logx("DoLeaderboard");
Leaderboard = Social.CreateLeaderboard();
Leaderboard.id = "MyGamesID";
Leaderboard.range = new Range(1, 100);
Leaderboard.LoadScores(result => DidLoadScores(result));
}
void DidLoadScores(bool result)
{
int i = 0;
D.logx("DidLoadScores");
NumScores = Leaderboard.scores.Length;
userIDs = new string[NumScores];
foreach(IScore score in Leaderboard.scores)
{
D.logx("DidLoadScores {0} : {1}", score.userID, score.value.ToString());
}
Social.LoadUsers(userIDs, DidLoadProfiles); //<<<<----This command does Nothing on IOS and OSX, it used to work prior to 5.3
}
void DidLoadProfiles(IUserProfile[] result)
{
D.logx("DidLoadProfiles");
foreach(IUserProfile profile in result)
{
D.logx("{0}",profile);
}
}
I’m not sure what you mean ‘reference’ the code above was based on the Unity Docs, it makes calls to Social so shouldn’t that be the reference? What form should the reference take? how should I change my code above to force GameKit to be linked?
Thanks for posting this bit of insight, it has been really useful. I was able to put a bit of “dummy” code into one of my scripts, it looked like this:
#if UNITY_STANDALONE_OSX
using UnityEngine.SocialPlatforms.GameCenter;
...
void Awake()
{
GameCenterPlatform gcp = new GameCenterPlatform();
gcp = null;
}
#endif
That must have encourage Unity to link the correct Game Center files, as this version passed Apple’s testing and has finally been released. Thanks very much for your help!
Please, is there any estimative on this? On the current state, is virtually impossible to successfully publish an Mac App Store game created from Unity which uses In App Purchasing and Achievements.