Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/110.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Phonegap/Cordova应用程序设备检测isn';我不想在iOS上工作_Ios_Cordova_Ipad - Fatal编程技术网

Phonegap/Cordova应用程序设备检测isn';我不想在iOS上工作

Phonegap/Cordova应用程序设备检测isn';我不想在iOS上工作,ios,cordova,ipad,Ios,Cordova,Ipad,我是一个年轻的开发者,他的学校项目在我的学校里迅速传播,然后变成了一个应用程序。我正在使用Phonegap,因为我在网络语言方面是最先进的。我决定迎合所有的设备,但最初是为iPhone的布局而设计的。为了让它在iPad上看起来更好,我使用Cordova设备检测来实现我的更改(我知道这很糟糕),如下所示: //Checks what device is being used var deviceType = (navigator.userAgent.match(/iPad/i)) == "iPa

我是一个年轻的开发者,他的学校项目在我的学校里迅速传播,然后变成了一个应用程序。我正在使用Phonegap,因为我在网络语言方面是最先进的。我决定迎合所有的设备,但最初是为iPhone的布局而设计的。为了让它在iPad上看起来更好,我使用Cordova设备检测来实现我的更改(我知道这很糟糕),如下所示:

//Checks what device is being used
var deviceType = (navigator.userAgent.match(/iPad/i))  == "iPad" ? "iPad" : (navigator.userAgent.match(/iPhone/i))  == "iPhone" ? "iPhone" : (navigator.userAgent.match(/Android/i)) == "Android" ? "Android" : (navigator.userAgent.match(/BlackBerry/i)) == "BlackBerry" ? "BlackBerry" : "null";
//Width & Height for Tannock Image
var width = 178.5;
var height = 270;
//If device is iPad
if(deviceType == "iPad"){ 
$('#teaImg').css('height', '540px');    
$('#teaImg').css('width', '357px');    
$('#text1').css('margin-left', '38%');
$('#text1').css("font-size", '35px');    
width = 357;
height = 270;    
}
当我通过Xcode直接将这段令人震惊的代码输入到我的iPad上时,它运行得非常好,但当我从应用商店下载它时,它不再工作了,因此它没有应用任何这些更改,而看起来像是我想要的

有人知道如何解决这个问题吗


p.s该应用程序名为Tannock Tapper,我知道它有问题,我是一个人团队,学校优先考虑。

我根据设备修复了代码,如下所示:

我将代码设置为我的格式供您使用

var isAndroid = navigator.userAgent.match(/android/i) ? true : false;
var isIPhone = navigator.userAgent.match(/iphone/i) ? true : false;
var isIPad = navigator.userAgent.match(/ipad/i) ? true : false;
var isBlackberry = (navigator.userAgent.match(/BlackBerry/i)) ? true : false; 

var width = 178.5;
var height = 270;

//If device is iPad
if(isIPad){ 
    $('#teaImg').css('height', '540px');    
    $('#teaImg').css('width', '357px');    
    $('#text1').css('margin-left', '38%');
    $('#text1').css("font-size", '35px');    
    width = 357;
    height = 270;    
}

// If device is android
if(isAndroid){
// android related code
}

if(isBlackberry){
// Black berry related code.
}
我的应用程序中也有相同的代码,我在应用程序商店中使用了过去3年的代码


如果看起来很困惑,请Ping我。

我根据设备修复了代码,如下所示:

我将代码设置为我的格式供您使用

var isAndroid = navigator.userAgent.match(/android/i) ? true : false;
var isIPhone = navigator.userAgent.match(/iphone/i) ? true : false;
var isIPad = navigator.userAgent.match(/ipad/i) ? true : false;
var isBlackberry = (navigator.userAgent.match(/BlackBerry/i)) ? true : false; 

var width = 178.5;
var height = 270;

//If device is iPad
if(isIPad){ 
    $('#teaImg').css('height', '540px');    
    $('#teaImg').css('width', '357px');    
    $('#text1').css('margin-left', '38%');
    $('#text1').css("font-size", '35px');    
    width = 357;
    height = 270;    
}

// If device is android
if(isAndroid){
// android related code
}

if(isBlackberry){
// Black berry related code.
}
我的应用程序中也有相同的代码,我在应用程序商店中使用了过去3年的代码


如果看起来很困惑,请打电话给我。

伙计,这是你的密码吗?然后您忘记了用“}”结束if条件。请更新正确的代码。伙计,这是你的代码吗?然后您忘记了用“}”结束if条件。请更新正确的代码。嘿,谢谢,希望这会起作用,但我没有办法测试它,只能发布应用程序的更新,我应该如何测试它,因为当我从Xcode输入到我的iPad时,它给了我一个不同的结果,因此我无法看到它是否起作用。从你的iPad中的Xcode,结果是什么,有什么错误吗?没有,我从platforms/ios获取xcodeproj文件,而不是您或我的版本。我是对的?是的,只要双击默认值,它就会在xcodeYes中打开。是的,我已经这样做了,但是当它在我的iPad上模拟时,没有错误,但是当我从应用商店下载它时,有一个错误。嘿,谢谢,希望这会起作用,但是我没有办法测试它,但是发布了应用程序的更新,我应该如何测试它,当我把它从Xcode输入到我的iPad时,它给了我一个不同的结果,因此我无法看到它是否工作。从你的iPad中的Xcode,结果是什么,有什么错误吗?没有,不是你的或我的版本,我从平台/ios获取xcodeproj文件。我说得对吗?是的,只要双击默认值,它就会在xcodeYes中打开。是的,我已经这样做了,但是当它在我的iPad上模拟时,没有错误,但是当我从应用商店下载它时,有一个错误