[英]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 ...)是float
或double
,在这种情况下, while loop
永远不会进入或永远不会离开 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.