我想知道的是什麼釋放我的[超級delloc] 的對象之前,釋放我行的目的[超級delloc]在[super delloc]語句前後釋放對象之間的區別?
例如, 之前之後的區別..
- (void)dealloc {
[theAudioPlayer stop];
[soundFilePath release];
[theAudioPlayer release];
[super dealloc];
}
現在釋放對象之後..
- (void)dealloc {
[super dealloc];
[theAudioPlayer stop];
[soundFilePath release];
[theAudioPlayer release];
}
當我用第一種情況下,我瀏覽我的viewController首先1日至2日的viewController類再來巴克2日至1日,然後它瓦特生病給我一些控制檯後面的錯誤。
#0 0x02d29c93 in objc_msgSend()
#1 0x0628ae60 in ??()
#2 0x02b24814 in __CFURLDeallocate()
#3 0x02b23ed0 in _CFRelease()
#4 0x0012af48 in -[NSURL release]()
#5 0x02795827 in -[AVAudioPlayer dealloc]()
#6 0x0000480e in -[ViewController dealloc] (self=0x6285340, _cmd=0x2c0a934) at /Users/ajm/Desktop/DetectiveJone/Classes/ViewController.m:209
#7 0x02d23e9d in objc_setProperty()
#8 0x0039f7b3 in -[UINavigationController setDisappearingViewController:]()
#9 0x0039ce91 in -[UINavigationController _clearLastOperation]()
#10 0x0039d732 in -[UINavigationController navigationTransitionView:didEndTransition:fromView:toView:]()
#11 0x0054d25f in -[UINavigationTransitionView _notifyDelegateTransitionDidStopWithContext:]()
#12 0x0054e39e in -[UINavigationTransitionView _navigationTransitionDidStop]()
#13 0x00325d54 in -[UIViewAnimationState sendDelegateAnimationDidStop:finished:]()
#14 0x00325be6 in -[UIViewAnimationState animationDidStop:finished:]()
#15 0x048a1933 in run_animation_callbacks()
#16 0x048a17da in CA::timer_callback()
#17 0x02b497dc in CFRunLoopRunSpecific()
#18 0x02b488a8 in CFRunLoopRunInMode()
#19 0x0356989d in GSEventRunModal()
#20 0x03569962 in GSEventRun()
#21 0x00307372 in UIApplicationMain()
#22 0x00002018 in main (argc=1, argv=0xbffff050) at /Users/ajm/Desktop/DetectiveJone/main.m:14
(gdb)
謝謝。那爲什麼當我在1st viewController類中播放聲音時,它將在瀏覽第2個viewController後繼續運行。我想聲音應該無限地播放,當我目前第一viewController類然後聲音將停止和對象應該釋放時,我導航第二viewController.Which我應該在那裏使用。 – Tirth 2010-10-21 07:51:00