iOS 设备上而非 iOS 模拟器上的文件路径损坏
我已经使用 Titanium Appcelerator 构建了我的应用程序。我可以在适用于 iPad 和 iPhone 的 iOS Simulator 上构建并运行我的应用程序。但是,当构建到我的设备时,我的 iPhone 版本找不到这些文件。 iPad 运行良好。
我正在检查 osname,并将这些变量相应地设置为 true 或 false,具体取决于它们运行的设备。就像我提到的,iPhone 模拟器完美地加载了该文件,但在 iPhone 上它会抛出一个错误的路径错误,这意味着我的 iPhone 变量被设置为 true,因为它试图找到它。在构建 iPhoen 时有什么我忽略的事情吗?代码如下所示:
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;
}
}
编辑:我编辑了代码以显示我所拥有的更具体的情况。
I've built my app with Titanium Appcelerator. I can build and run my app on iOS Simulator for iPad and iPhone. However, when building to my devices, my iPhone build can't find the files. iPad works fine.
I'm checking for the osname, and setting these variables accordingly to true or false, depending on which device they're running. 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. Is there something I'm overlooking when building to 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我解决了这个问题。事实证明,它不起作用的唯一原因是该文件夹被命名为“iphone”。也许这与图像所在的默认 iphone 文件夹冲突?无论如何,我将该文件夹重命名为“phone”,现在工作正常。很奇怪。
I solved the issue. It turns out that the only reason it wouldn't work was because the folder was named 'iphone'. Perhaps this conflicts with the default iphone folder where the images are? Regardless, I renamed the folder to phone and it works fine now. Very strange.