开发者

How do I find my error in XCode? (iphone project)

开发者 https://www.devze.com 2023-02-04 18:24 出处:网络
I\'m still relatively new to XCode.I\'m trying to build an iPhone application and after my application didFinishLaunchingWithOptions method runs but not inside of any code I ca开发者_如何转开发n find

I'm still relatively new to XCode. I'm trying to build an iPhone application and after my application didFinishLaunchingWithOptions method runs but not inside of any code I ca开发者_如何转开发n find I get this error:

[58036:207] *** -[_PFArray release]: message sent to deallocated instance 0x17cd2fe0

I have no idea what that means apart from the fact that some array somewhere is being released when it's already released?

The real problem, is that I have no clue how to use the information provided there to find where the error is. There is no line of code to look in, no variable name, etc.

How do I use this information to find what I'm looking for?


try enabling zombies, then xcode puts a breakpoint automatically to the line where this error occurs. Google nszombieenabled for more information

Edit: Well, I don't have much thing to do so here your guide,

  1. Open instruments. It is an application and you can find it in "~/Developer/applications/instruments" (in a default installation path). Instruments will be your right hand so master it well.

  2. In the opening screen, you will see a bunch of templates. Open the one named "Zombies". Note: You will often use the template named "Leaks". It shows all the memory leaks you forget to release.

  3. From "choose target" (top left corner), select "choose target", and again select "choose target". From here, browse the project directory, and choose "build/Debug-iphonesimulator/executableName". Here I assume that you have built your project in debug profile with nszombieenabled to true. If not, build it so and reply 3.

  4. Press record button (top left corner). The simulator will appear and your app will start. Then reproduce the error you have encountered.

  5. Instruments will interrupt the app showing a message bubble. Do not close the bubble. From the bar in the middle of the window, select "objects list" instead of "statistics". Now, all the objects allocated up to this point lies in a list sorted by their memory addresses. Here scroll down to the memory address written inside the bubble. You can type the initial letters for fast scroll. Then double click the line you found. This brings you to the code where the object is allocated IF THE CODE IS YOURS. If it is not, then ios allocated the object. But do not worry, and double click the lines below and above to see if they are allocated by you. This should give you a hint where may be the problem is since these lines triggered ios to allocate the object (possibly).

This is all I can say. I hope you can find what causes this error.

0

精彩评论

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

关注公众号