1
votes

I have submitted one iOS application developed using Cordova/Sencha Touch but it being rejected.

I have one functionality which will behave different for iphone and ipad. I am using this code to identify device type :

Ext.os.deviceType.toLowerCase() == "phone"

But this always returns "phone" even if I run this app on ipad simulator.

So, how to fix this issue so I can submit this app successfully to app store.

Thanks.

1

1 Answers

0
votes

On Cordova I use the following functions to detect platform:

function isAndroid() {
    return navigator.userAgent.indexOf("Android") > 0;
}
function isiOS() {
    return (isiPhone() || isiPad());
}
function isiPhone() {
    return (navigator.userAgent.indexOf("iPhone") > 0 || navigator.userAgent.indexOf("iPod") > 0) || $(window).width() <= 320;
}
function isiPad() {
    return navigator.userAgent.indexOf("iPad") > 0 || ($(window).width() <= 1000 && $(window).width() > 320);
}

The $(window).width() is to help testing on desktop.