简体   繁体   中英

iPhone App crashes on iOS 4, works well on 3.x

I wrote a small application using iPhone 3.x sdk. The app works well on device/simulator 3.x. But when I switch to device/simulator 4, it exit directly when I navigate among the tab pages. Here is the log form ~/Library/Logs/CrashReporter,

Exception Type: EXC_BAD_ACCESS (SIGBUS) Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000003 Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Application Specific Information: objc_msgSend() selector name: isKindOfClass: iPhone Simulator 4.0 (211.1), iPhone OS 4.0.2 (iPhone/8A400a)

Thread 0 Crashed: Dispatch queue: com.apple.main-thread 0 libobjc.A.dylib 0x02502a97 objc_msgSend + 27 1 UIKit 0x00303f20 -[UIView(Internal) _didMoveFromWindow:toWindow:] + 955

Could you please give me some help, thanks in advance.

Linkou Bian Email/MSN: linkou.bian@gmail.com

I wrote this blog to help understand and debug EXC_BAD_ACCESS

Basically, you are dereferencing a pointer that is pointing to memory that isn't allocated to your process. The main reasons that this could happen are

  1. You are using an object that has been deallocated
  2. The heap is corrupt

The things you should do to debug this:

  1. Do a Build and Analyze. The reports of leaks are bad, but not related to this issue -- you want to look for issues of too few retains

  2. Turn on Zombies and run in the debugger . Now, none of your objects will be deallocated, but when they have a retain count 0, they will complain to the debugger if you use them.

There are other tips on the blog that are a little harder to explain

i am developed VUmeter functionality with live radio streaming. it's working well when i run into simulator version 4.0 but in device(3GS,4.0) its not working i am not getting updated values of audiolevels. suppose at first time when method call i got value levels: 0.001817, peakLevels: 0.005463 its remain same not changed whereas in simulator same code working well.

levels[0]        = self.audioLevels[0].mAveragePower ;
peakLevels[0]    = self.audioLevels[0].mPeakPower ;   

suggestion or advice require...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM