Application runs one time but crashes the second time
Hello everyone how are you, Guys i am working on an app and its really pisssing me out, the app is deployed in the device 开发者_开发技巧and runs nicely the first time when i use it but when i stop the execution of the app in the device and then try to run it the next time then the touch screen hangs up and i am left with a black screen and then i reinstall my app again.
In the viewDidLoad i am using the instance of MKMapView and showing the users current location thats all
Please help me out
Your problem may be in not properly releasing your map delegate. I assume that since you create your MKMapView in viewDidLoad, you release it in the viewDidUnload, which most likely gets called when you fast switch the app. If you have set delegate for the MKMapView you created, you have to set the map view's delegate = nil before you release the MKMapView.
Alright, since your app crashes upon starting, it's probably something in your viewDidLoad. Without the code itself I can't really get into more detail, but do you have any saving/loading code for your app? That might explain why it works the first time but crashes after that.
OK Radix, let's build on @Nichola1024's answer. Start by commenting out your entire -viewDidLoad
method entirely. Does that fix the problem?
If so, then that means it's inside of your -viewDidLoad
method. So, next uncomment the entire method, but comment out all of your MKMapView
-related code and see if it's still crash-y.
If it's not crashing, then you know the error is somewhere in the commented-out code. Just keep commenting out smaller and smaller sections of the code and you'll get there.
Without seeing your actual -viewDidLoad
method, this is the best we'll probably be able to give you.
精彩评论