开发者

App runs fine from Xcode, but crashes when loaded from home screen

开发者 https://www.devze.com 2023-03-28 04:04 出处:网络
As the title suggests, I have an app that runs fine when launched from Xcode, but crashes when launched from the home screen.

As the title suggests, I have an app that runs fine when launched from Xcode, but crashes when launched from the home screen.

Running build and analyze shows no memory leaks or warnings. (Although, I'm not ruling it out as a false sense of security.)

The corresponding Device Log shows:

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Ex开发者_高级运维ception Codes: KERN_INVALID_ADDRESS at 0x0439e000

Which makes me think this is a release/retain issue, but why didn't it show up in Build/Analyze? And why would it run fine when running from Xcode?

EDIT

I should also note that the app "runs" fine in the simulator both from Xcode and from a home screen launch. I say "runs," because it uses the camera, so running on the simulator isn't all that useful in this case.


UPDATE

Thanks, all. All resources seem to be properly named. I'm trying to get the atos command to work properly. I keep getting the same address back instead of the class file name and line number.


Sometimes (maybe in your case) when an app is first launched from the XCode it is build and run as a new instance of the application. When you then stopp it and try to run it from the home screen it might launch from background. If you didn't manage your memory properly for a state when your app launches from the background the analyzer will not pick up memory problems. To find out if that is the case, try to double click on the home button and quit your app if it appears there. Then launch it again from the home screen. You can also try to debug it with the instruments.


Forget atos. I realized the Device Logs list which thread, file, and line number the crash occurred at. It's consistently in my AVCaptureSession delegate captureOutput method.

I was getting CVPixelBufferGetBaseAddress values on the order of 200 times higher when run "unplugged". I also discovered that when I ran a simple diagnostic NSLog in one of the loops, the crashing stopped (but it prevented something on the main thread from being called, so this was not a permanent fix).

In the process, I made a stab in the dark tweak, removing an operation on the base address. In attempt to save loop iterations, I was doing something like this to skip every other pixel in the buffer:

byteIndex   += (bytesPerPixel * 2);

Dropping down to the following fixed the problem completely:

byteIndex   += (bytesPerPixel);
0

精彩评论

暂无评论...
验证码 换一张
取 消