three20 中 toModalViewController 不會釋放物件的問題

24 views
Skip to first unread message

Ehrippura

unread,
May 22, 2012, 5:46:15 AM5/22/12
to cocoaheads.tw
不知道有沒有人碰過這個問題,就是如果使用 three20 中 TTURLMap -from:toModalViewController
來建立 View Controller,即使你把它 dismiss 掉,該物件依然留在記憶體裡面。

這還不夠糟糕,更糟的是當你收到 memory warning 之後,程式會崩潰!

不知道有沒有人也有過類似的經驗的?

Evadne Wu

unread,
May 22, 2012, 6:17:10 AM5/22/12
to cocoah...@googlegroups.com
Where’s your code?
> --
> 您已訂閱「Google 網上論壇」的「cocoaheads.tw」群組,因此我們特別傳送這封郵件通知您。
> 如要在此群組張貼留言,請傳送電子郵件至 cocoah...@googlegroups.com
> 如要取消訂閱此群組,請傳送電子郵件至 cocoaheadstw...@googlegroups.com
> 如需更多選項,請造訪此群組:http://groups.google.com/group/cocoaheadstw?hl=zh-TW
>

Ehrippura

unread,
May 22, 2012, 9:30:34 PM5/22/12
to cocoah...@googlegroups.com
其實就是簡單的

App Delegate:
[map from: @"xx://controller" toModalViewController: [SomeController class]];


Some where:
TTURLAction *action = [TTURLAction actionWithURLPath:@"xx://controller"];
[[TTNavigator navigator] openURLAction:action];

最後在 SomeController 的 view 裡面加上一個 Button 去 call

[[self parentViewController] dismissModalViewControllerAnimated:YES];

我在 view controller 裡面加上加上幾個 event log,發現即使你 dismiss 掉這個 Modal View,這個 log 依然會被執行到。
加上 bp 在 dealloc 就會發現,dealloc 也沒有被執行過!
照理來說,我根本就不需要去管這個 Controller 的建立跟釋放…

three20 真是越用自信心越低

Evadne Wu於 2012年5月22日星期二UTC+8下午6時17分10秒寫道:
Where’s your code?

On May 22, 2012, at 5:46 PM, Ehrippura <ehri...@gmail.com> wrote:

> 不知道有沒有人碰過這個問題,就是如果使用 three20 中 TTURLMap    -from:toModalViewController
> 來建立 View Controller,即使你把它 dismiss 掉,該物件依然留在記憶體裡面。
>
> 這還不夠糟糕,更糟的是當你收到 memory warning 之後,程式會崩潰!
>
> 不知道有沒有人也有過類似的經驗的?
>
> --
> 您已訂閱「Google 網上論壇」的「cocoaheads.tw」群組,因此我們特別傳送這封郵件通知您。
> 如要在此群組張貼留言,請傳送電子郵件至 cocoah...@googlegroups.com
> 如要取消訂閱此群組,請傳送電子郵件至 cocoaheadstw+unsubscribe@googlegroups.com
> 如需更多選項,請造訪此群組:http://groups.google.com/group/cocoaheadstw?hl=zh-TW
>

Jamie Sa

unread,
May 22, 2012, 9:33:47 PM5/22/12
to cocoah...@googlegroups.com, cocoah...@googlegroups.com
I give it long ago. 

jamie ~ )
如要在網路上查看這項討論,請造訪 https://groups.google.com/d/msg/cocoaheadstw/-/-Mmh95_85RIJ
如要在此群組張貼留言,請傳送電子郵件至 cocoah...@googlegroups.com

Evadne Wu

unread,
May 23, 2012, 12:11:42 AM5/23/12
to cocoah...@googlegroups.com
Well treat it as a persistent singleton then, but a word of comfort: view controllers are small ;)


On May 23, 2012, at 9:30, Ehrippura <ehri...@gmail.com> wrote:

其實就是簡單的

App Delegate:
[map from: @"xx://controller" toModalViewController: [SomeController class]];


Some where:
TTURLAction *action = [TTURLAction actionWithURLPath:@"xx://controller"];
[[TTNavigator navigator] openURLAction:action];

最後在 SomeController 的 view 裡面加上一個 Button 去 call

[[self parentViewController] dismissModalViewControllerAnimated:YES];

我在 view controller 裡面加上加上幾個 event log,發現即使你 dismiss 掉這個 Modal View,這個 log 依然會被執行到。
加上 bp 在 dealloc 就會發現,dealloc 也沒有被執行過!
照理來說,我根本就不需要去管這個 Controller 的建立跟釋放…

three20 真是越用自信心越低

Evadne Wu於 2012年5月22日星期二UTC+8下午6時17分10秒寫道:
Where’s your code?

On May 22, 2012, at 5:46 PM, Ehrippura <ehri...@gmail.com> wrote:

> 不知道有沒有人碰過這個問題,就是如果使用 three20 中 TTURLMap    -from:toModalViewController
> 來建立 View Controller,即使你把它 dismiss 掉,該物件依然留在記憶體裡面。
>
> 這還不夠糟糕,更糟的是當你收到 memory warning 之後,程式會崩潰!
>
> 不知道有沒有人也有過類似的經驗的?
>
> --
> 您已訂閱「Google 網上論壇」的「cocoaheads.tw」群組,因此我們特別傳送這封郵件通知您。
> 如要在此群組張貼留言,請傳送電子郵件至 cocoah...@googlegroups.com
> 如要取消訂閱此群組,請傳送電子郵件至 cocoaheadstw...@googlegroups.com
> 如需更多選項,請造訪此群組:http://groups.google.com/group/cocoaheadstw?hl=zh-TW
>

--
您已訂閱「Google 網上論壇」的「cocoaheads.tw」群組,因此我們特別傳送這封郵件通知您。
如要在網路上查看這項討論,請造訪 https://groups.google.com/d/msg/cocoaheadstw/-/-Mmh95_85RIJ
如要在此群組張貼留言,請傳送電子郵件至 cocoah...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages