Highscores works from Mac (Unity 3 iPhone), but can't submit from iPhone?

Having some trouble with my game’s highscores. When playing the game in-editor (Unity 3 iPhone), I can submit highscores just fine, or from the webplayer, etc.

However, the score’s I submit from my iPod touch only go into the “local scores”, they never make it online…I’ve even waited a full day and checked the MySQL database…no sign of the entries.

Is there a special catch/bit of code/check-box-enabled on an iOS device to allow it to send scores? It seems perfectly capable of viewing the online highscores table, just can’t get it to output to online.

I am using this setup:
http://www.unifycommunity.com/wiki/index.php?title=Server_Side_Highscores

With this code for submitting:

	//submit sccore button- only show if score hasn't been submitted, otherwise only show "Main Menu" button
	wd = 200;
	ht = 40;
	if (!scoreSubmitted)
	{
		if (GUI.Button(Rect(125 - wd/2, titleOffset + 4*voffset + 4*ht, wd, ht), "Submit Score!"))
		{
			//play button pressed noise
			GUIControlScript.GUISoundsScript.GUISounds[1].audio.Play();
			
			//convert string to all caps
			inputName = inputName.ToUpper();
			
			//Check if name is dirty...
			// Old method
			
			for (var x = 0; x < dirtyNames.length; x++)
			{
				dirtyName = false;
				if (inputName == dirtyNames[x])
				{
					inputName = "ERR";
					dirtyName = true;
					break;
				}
			}
						
			//submit the score if name is clean
			if(!dirtyName)
			{
				//tell the game we have submitted the score (no spamming)
				scoreSubmitted = true;
				
				//Update local score with the inputs above
				scoreKeeperLocal.postScore(inputName, gameInfoScript.currentScore);
				scoreKeeperLocal.getScores();
				
				//update global score same
				scoreKeeper.postScore(inputName, gameInfoScript.currentScore);
				scoreKeeper.getScores();
			}
		}
	}

…and here is the “scoreKeeper.postScore” bit, on another script:

function postScore(name, score) 
{
    //This connects to a server side php script that will add the name and score to a MySQL DB.
    // Supply it with a string representing the players name and the players score.
    //var hash=Md5.Md5Sum(name + score + secretKey);
    var theName : String = name;
    var hash=Md5.Md5Sum(theName + score + secretKey); 

    var highscore_url = addScoreUrl + "name=" + WWW.EscapeURL(name) + "&score=" + score + "&hash=" + hash;
        
    // Post the URL to the site and create a download object to get the result.
    hs_post = WWW(highscore_url);
    yield hs_post; // Wait until the download is done
    if(hs_post.error) 
    {
        print("There was an error posting the high score: " + hs_post.error);
    }

}

Like I said, guessing I’m just missing a compatibility/syntax issue. I DO remember I had to change “data” to “text” when upgrading to Unity 3…but even after that, it still submits fine from the editor, yet not from device.

Thanks for any input :slight_smile:

no help on this one? (bump)

This is really the last remaining issue on my game…I’d like to figure it out, looking around but not finding answers…

Still no luck…looks like I’ll be launching with no high scores. :frowning:

Does anyone else have an iOS-based global highscores script/implementation they would be wonderfully kind enough to share?? Or just some insight on why my setup is failing?

I am afraid everybody is using the official Apple leaderboards or some external ready API instead than building the thing up from scratch.

Did you ever figure this out?

I have the same problem. Everything works perfectly fine in Unity, but when I get it onto the iPhone device it doesn’t work.

This is becoming a norm for me too.

I’m constantly having to test everything because it works in Unity, but not on the iPhone.

I’m open to any other ways to achieve high scores.

Can someone hook a brother up?

I ran the console in XCode and got the following error when running on the iPhone.

It’s choking on javascript again. Unfortunately, it doesn’t give me any clues as to where to start . . .


ExecutionEngineException: Attempting to JIT compile method ‘(wrapper dynamic-method) Boo.Lang.Runtime.RuntimeServices:RuntimeServices$op_Addition$System.String$System.String (object,object[ ])’ while running with --aot-only.

at System.Delegate.CreateDelegate (System.Type type, System.Object firstArgument, System.Reflection.MethodInfo method, Boolean throwOnBindFailure) [0x00000] in :0
at System.Delegate.CreateDelegate (System.Type type, System.Reflection.MethodInfo method, Boolean throwOnBindFailure) [0x00000] in :0
at System.Delegate.CreateDelegate (System.Type type, System.Reflection.MethodInfo method) [0x00000] in :0
at System.Reflection.Emit.DynamicMethod.CreateDelegate (System.Type delegateType) [0x00000] in :0
at Boo.Lang.Runtime.DynamicDispatching.Emitters.DispatcherEmitter.CreateMethodDispatcher () [0x00000] in :0
at Boo.Lang.Runtime.DynamicDispatching.Emitters.DispatcherEmitter.Emit () [0x00000] in :0
at Boo.Lang.Runtime.DynamicDispatching.MethodDispatcherFactory.EmitMethodDispatcher (Boo.Lang.Runtime.CandidateMethod found, System.Type[ ] argumentTypes) [0x00000] in :0
at Boo.Lang.Runtime.DynamicDispatching.MethodDispatcherFactory.Create () [0x00000] in :0
at Boo.Lang.Runtime.RuntimeServices.DoCreateMethodDispatcher (System.Object target, System.Type targetType, System.String name, System.Object[ ] args) [0x00000] in :0
at Boo.Lang.Runtime.RuntimeServices.CreateMethodDispatcher (System.Object target, System.String name, System.Object[ ] args) [0x00000] in :0
at Boo.Lang.Runtime.RuntimeServices+c__AnonStorey13.<>m__7 () [0x00000] in :0
at Boo.Lang.Runtime.DynamicDispatching.DispatcherCache.Get (Boo.Lang.Runtime.DynamicDispatching.DispatcherKey key, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory) [0x00000] in :0
at Boo.Lang.Runtime.RuntimeServices.Dispatch (System.Object target, System.String cacheKeyName, System.Type[ ] cacheKeyTypes, System.Object[ ] args, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory) [0x00000] in :0
at Boo.Lang.Runtime.RuntimeServices.Dispatch (System.Object target, System.String cacheKeyName, System.Object[ ] args, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory) [0x00000] in :0
at Boo.Lang.Runtime.RuntimeServices.Invoke (System.Object target, System.String name, System.Object[ ] args) [0x00000] in :0
at Boo.Lang.Runtime.RuntimeServices.InvokeRuntimeServicesOperator (System.String operatorName, System.Object[ ] args) [0x00000] in :0
at Boo.Lang.Runtime.RuntimeServices.InvokeBinaryOperator (System.String operatorName, System.Object lhs, System.Object rhs) [0x00000] in :0
at HealthControl+$postScore$43+$.MoveNext () [0x00000] in :0
UnityEngine.MonoBehaviour:StartCoroutine_Auto(IEnumerator)
HealthControl:Update()

(Filename: Line: -1)

Ok, I fixed the error I was getting in the XCode console.

Basically, I changed the following line . . .

function postScore(name, score)

to the following . . .

function postScore(name : String, score : int)

So now I have a clean console log with no errors. However, it still doesn’t work from the iPhone. :frowning:

Actually the last fix made everything work!!!

Let me know if you’re still stuck after making the change above.