After getting information about cell EXC_BAD_ACCESS

I am using CellStumbler to get iPhone cell id, location area code and other information.

I get EXC_BAD_ACCESS after calling getInfo and I can't figure out why. These are all undocumented private functions, but surely someone can help. The problem is not related to any of the lines in this function, it is only after it has been run.

Cell stumbler

I know this is not the App Store.

  int cellcount;

printf("Cell count: %x\n",cellcount);

printf("Size = %lx\n", sizeof(struct CellInfo));

unsigned char *a=malloc(sizeof(struct CellInfo));

    _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);


This is the getCellInfo function available in the above CellStumbler project. The error occurs after it is called, but not necessarily in this function, only after, as if there was some memory manipulation after starting this operation.


source to share

1 answer

I temporarily solved this problem by removing the for loop and only running _CTServerConnectionCellMonitorGetCellInfo once.



All Articles