简体   繁体   English

iOS设备(而不是iOS Simulator)上的文件路径损坏

[英]Broken file path on iOS device, not on iOS Simulator

I've built my app with Titanium Appcelerator. 我已经用Titanium Appcelerator构建了我的应用程序。 I can build and run my app on iOS Simulator for iPad and iPhone. 我可以在iPad和iPhone的iOS模拟器上构建和运行我的应用程序。 However, when building to my devices, my iPhone build can't find the files. 但是,在构建到我的设备时,我的iPhone构建无法找到文件。 iPad works fine. iPad工作正常。

I'm checking for the osname, and setting these variables accordingly to true or false, depending on which device they're running. 我正在检查osname,并将这些变量相应地设置为true或false,这取决于它们正在运行的设备。 Like I mentioned, the iPhone simulator loads the file perfectly, but on the iPhone it throws up a bad path error, which means my iPhone variable is being set to true, since it's attempting to find it. 就像我提到的那样,iPhone模拟器完美地加载了文件,但是在iPhone上它抛出了错误的路径错误,这意味着我的iPhone变量被设置为true,因为它正在尝试查找它。 Is there something I'm overlooking when building to iPhoen? 在构建iPhoen时,我有什么要忽略的吗? The code looks like this: 代码如下:

var ipad = false;
var iphone = false;
var iOSCheck = function(){
if(Titanium.Platform.osname == 'ipad'){
    ipad = true;
    Titanium.include('games/views/ipad/options.js');
} else if(Titanium.Platform.osname == 'iphone'){
    iphone = true;
    Titanium.include('games/views/iphone/options.js');
} 
    if(iphone || ipad){
        Titanium.UI.iPhone.statusBarStyle = Titanium.UI.iPhone.StatusBar.OPAQUE_BLACK;
    }
}

EDIT: I've edited the code to show a more specific senario of what I have. 编辑:我已经编辑了代码以显示我所拥有的更具体的参考。

I solved the issue. 我解决了这个问题。 It turns out that the only reason it wouldn't work was because the folder was named 'iphone'. 事实证明,它不起作用的唯一原因是因为该文件夹名为“ iphone”。 Perhaps this conflicts with the default iphone folder where the images are? 也许这与图像所在的默认iphone文件夹冲突? Regardless, I renamed the folder to phone and it works fine now. 无论如何,我将文件夹重命名为phone,现在可以正常工作了。 Very strange. 很奇怪。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM