简体   繁体   English

在实际设备上发生SIGSEGV错误,但在iOS模拟器上未发生

[英]SIGSEGV Error occurs on the actual device but not on ios simulator

I am the developer of a cydia tweak named CountdownCenter. 我是一个名为CountdownCenter的cydia调整程序的开发人员。 I was trying to create a digital clock appearance for my widget, so I created a sample app that does this perfectly. 我试图为小部件创建数字时钟外观,因此我创建了一个示例应用程序,可以完美地做到这一点。 After doing this, I transferred this data into the code of my tweak but, this causes a SIGSEGV crash on my iPhone. 完成此操作后,我将此数据传输到我的调整代码中,但是这导致iPhone上发生SIGSEGV崩溃。 After some testing, I found the part that is responsible for the crash, but I just can't find what's wrong as this part would work on a normal app. 经过一些测试,我发现了导致崩溃的那部分,但是我只是找不到什么问题,因为这部分可以在正常的应用程序上运行。 Can you help me please? 你能帮我吗?

Here is the code: 这是代码:

int digitarray[10];
    int c = 0;
    digitarray[0] = 0;
    digitarray[1] = 0;
    while (secon>0) {
        int digitt = secon % 10;
        digitarray[c] = digitt;
        secon /= 10;
        c++;
    }
        lbl.text = [NSString stringWithFormat:@"%d", digitarray[0]];
          [self selectimage:digitarray[0] img:numview10];

SIGSEGV usually means, that you're trying to access memory, that you are not allowed to access. SIGSEGV通常意味着,您正在尝试访问内存,不允许您访问。 (btw are you testing this with a release build?) Maybe fe here (there are some other similar places too): (顺便说一下,您是否正在使用发布版本对其进行测试?)也许在这里(也有一些其他类似的地方):

c = 0;
while (secon>0) {
    int digitt = secon % 10;
    digitarray[c] = digitt;
    secon /= 10;
    c++;
}

There are some possibilities: 有一些可能性:

  • secon (horrible variable names btw...) is a float or double , in that case the while loop is either never entered or never left secon (可怕的变量名btw ...)是floatdouble ,在这种情况下, while loop永远不会进入或永远不会离开
  • c becomes so large that it's beyond digitarray 's bounds c变得如此之大以至于它超出了digitarray的范围

To solve this issue I would recommend to but a breakpoint at the beginning of your code and check it step by step. 为了解决这个问题,我建议在代码的开头加上一个断点,并逐步检查它。

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

相关问题 iOS实际设备上的Appium出现SDK Iphone Simulator错误 - Appium on ios actual device gives sdk iphone simulator error 适用于iOS的Dropbox SDK适用于模拟器,而不适用于实际设备 - Dropbox SDK for iOS works on simulator, not on actual device 在模拟器和实际iOS设备上存储文件 - Storing files on simulator vs actual iOS device iPhone:SIGSEGV在设备上看似随机(ViewDidLoad,setFont等),从不在模拟器中 - iPhone: SIGSEGV occurs seemingly randomly (ViewDidLoad, setFont, etc.) on device, never in simulator 模拟器中的iOS 6自动旋转与实际的iOS 6设备不同 - iOS 6 autorotation in simulator varies from actual iOS 6 device 模拟器中的iOS应用布局与实际设备上的布局不同 - iOS app layout in the simulator different than on the actual device 音频文件可在iOS模拟器中运行,但无法在实际设备上找到 - Audio files working in iOS simulator, but can't be found on actual device ios 模拟器和实际设备中的捆绑行为不同 - Bundle behaviour differs inside ios simulator and actual device ios9-Xcode 7-Swift-键盘在模拟器中正确显示,但在实际设备上未正确显示 - ios9 - Xcode 7 - Swift - Keyboard shows correctly in Simulator but not on an actual Device 无效设备 State - Xcode/iOS 模拟器错误 - Invalid Device State - Xcode/iOS Simulator error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM