IPhone游戏可以在设备上运行.在模拟器中的特定关卡崩溃

iphone game runs on devices. crash on specific level in simulator

本文关键字:模拟器 崩溃 运行 游戏 IPhone      更新时间:2023-10-16

我开发了一款目前在iphone/ipad/ipod touch上运行的游戏,没有任何问题。最近我需要在模拟器上运行它,我发现它在启动一个关卡时在特定的加载函数上崩溃,我去了user/Library/Logs/DiagnosticReports中的崩溃报告,看到abort()在一个游戏对象的构造函数被调用后被调用:

0   libSystem.B.dylib               0x93100ef6 __kill + 10
1   libSystem.B.dylib               0x93100ee8 kill$UNIX2003 + 32
2   libSystem.B.dylib               0x9319362d raise + 26
3   libSystem.B.dylib               0x931a9679 __abort + 124
4   libSystem.B.dylib               0x9318c3bc release_file_streams_for_task + 0
5   gamehere                        0x0004d650 Piso::Piso(W3d*, int, int) + 758 (Piso.cpp:45)

所以我去"Piso.cpp",看到第45行只是这个对象的构造函数的结束括号。

我真的不知道是什么导致了这个崩溃,在构造函数中,我加载纹理,初始化一些计数器,数组和其他东西的类,再一次,这些都会导致问题在设备上运行…

我真的很感激一些关于在哪里看,以解决这个问题的想法。谢谢!。

右括号表示某个局部变量的析构函数。例如:

struct Test {
    ~Test() {
        throw "error";
    }
}
int main() {
    int b;
    {
        Test a;
    };    //On your stack trace, here it will be pointed as the error line.
    b = 1;
};

我一点也不担心,只要它能在实际设备上工作,模拟器不能100%重现设备所能做的事情。