Detecting iphone5 at runTime

iam porting may Game to iphone5 , and for that i have created a method to detect is device is iphone5 or not.

static function IsIphone5 ():boolean {

	var rtn:boolean = false;
	
	var mPlatform = Application.platform;
	if (mPlatform == RuntimePlatform.IPhonePlayer) {
	    
		Debug.Log("IPhone Player Detected");
		Debug.Log("IPhone Player Screen.height = "+Screen.height);
		Debug.Log("IPhone Player Screen.width = "+Screen.width);
		    
	    if ((Screen.width == 640  Screen.height == 1136) ||(Screen.width == 1136  Screen.height == 640))  {
	    	// iPhone5
	    	Debug.Log(" yes IPhone5 Detected");
			rtn = true;
	    }
	    else {
			rtn = false;
	    }
	}
	
	return rtn;
}

but on my device iPhone 5 still i am getting Screensize width = 640 and height = 960.which are for iphone 4,4s.
the same kind of device detection (Based on HeightxWidth) are working fine for other Devices(iPad,ipad3).

my development environment
Unity version 3.5.6
Xcode 4.5
deployment target ios5.0

Base SDK ios 6.0

what would be problem ? why iam getting screen height = 960
or any help ??? how can i detect at run time that device is iPhone5

any help is highly appreciated…

I had the same problem with early 3.5.6 version. Update to 3.5.7 and try again, might be because of that. If you don’t have a correct splash image in your project, it might force it to revert lower resolution.

iOS acts as if the screen is 960 if no iPhone 5 splash image is present. This is for compatibility with existing apps. I believe 3.5.7 includes iPhone 5 device info, so you can use the standard detection method.

mtoivo , moonjump.
thanks man
You both are right. i used a correct splash image and problem is solved…:slight_smile: