2
我使用CellStumbler获取iPhone的单元ID,位置区域代码和其他信息。获取单元信息后,引发EXC_BAD_ACCESS
调用getInfo后,我得到一个EXC_BAD_ACCESS,我找不到原因。这都是无证的私人功能,但肯定有人可以提供帮助。该问题与函数中的任何行都没有关联,只有在运行后才会发生。
我知道这是不是App Store中可批准。
int cellcount;
_CTServerConnectionCellMonitorGetCellCount(&t1,sc,&cellcount);
printf("Cell count: %x\n",cellcount);
printf("Size = %lx\n", sizeof(struct CellInfo));
unsigned char *a=malloc(sizeof(struct CellInfo));
for(b=0;b<cellcount;b++)
{
_CTServerConnectionCellMonitorGetCellInfo(&t1,sc,b,a); memcpy(&cellinfo,a,sizeof(struct CellInfo));
printf("Cell Site: %d, MNC: %d, ",b,cellinfo.servingmnc);
printf("Location: %d, Cell ID: %d, Station: %d, ",cellinfo.location, cellinfo.cellid, cellinfo.station);
printf("Freq: %d, RxLevel: %d, ", cellinfo.freq, cellinfo.rxlevel);
printf("C1: %d, C2: %d\n", cellinfo.c1, cellinfo.c2);
}
if(a) free(a);
这是上面的CellStumbler项目中可用的getCellInfo函数。这个错误发生在这个被调用之后,但不一定在这个函数中,只有在这之后,就好像运行这个后来的效果是一些内存损坏一样。
请包括您的一些代码。也许甚至是造成错误的部分? – jrturton 2011-12-16 10:13:51