I am the developer of a cydia tweak named CountdownCenter. 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. 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. (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 digitarray
's bounds To solve this issue I would recommend to but a breakpoint at the beginning of your code and check it step by step.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.