Signal 11, segmentation fault on iphone App exit

2019-01-18 15:55发布

问题:

I have an iphone app. It seems to run fine. When I connect to a provisioned iphone to Xcode and run the App, the console log in the Organizer window, always complains about a Segmentation fault when quitting the app with the home key.

Has anyone else seen this, and do you have an idea of what the problem might be? I use a thread to load web pages in the backround, but I stop the thread when exiting.

My app does save some persistent information. When I use the build and analyze function I get some 2 potential memory leaks, but in each case I'm allocating an object and keeping it in an array.

Any ideas, or is this normal?

回答1:

Try running your application with NSZombieEnabled. This will tell you if you're over releasing any object. To enable zombies do the following:

  1. Choose Project > Edit Active Executable to open the executable Info window.
  2. Click Arguments.
  3. Click the add (+) button in the “Variables to be set in the environment” section.
  4. Enter NSZombieEnabled in the Name column and YES in the Value column.
  5. Make sure that the checkmark forthe NSZombieEnabled entry is selected.


回答2:

Upon exit your application can over-release an object try dumping each object before releasing it or do some debugging in dealloc method.



回答3:

Perhaps you are releasing some object more times than its retain count. Comment out -release calls in your dealloc methods (or elsewhere) until you find the culprit.

Then uncomment-out that call and look elsewhere in your code where you are trying to over-release that object.

If you are using convenience methods, for example, (e.g. [NSString stringWithFormat:@"..."]) as opposed to alloc-init methods (e.g. [[NSString alloc] initWithFormat:@"..."]) the resulting convenience object is autoreleased and should not be manually released.



回答4:

My problem was uididfaker and locationholic from cydia, and after uninstalling them xcode run on my iphone just fine.