2015-02-11 160 views
0

我們當地的低內存警告使用此代碼反應警告:低內存有足夠的空RAM

- (void)manageMemoryWarning { 
    [[[SPAlertView alloc] initWithTitle:kHinweis message:[WWSError errorTextForCode:WWSErrorSpeicherfastvoll] delegate:self cancelButtonTitle:@"OK" otherButtonTitles:@"Hilfe", nil] show]; 
} 

- (void)start { 
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(manageMemoryWarning) name:UIApplicationDidReceiveMemoryWarningNotification object:nil]; 
} 

- (void)stop { 
    [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidReceiveMemoryWarningNotification object:nil]; 
} 

雖然有320MB空的RAM空間應用越來越這樣的警告,並呈現警報用戶。爲什麼警告被解僱?有足夠的空間。

Warning

+0

@HAS警報由didReceiveMemoryWarning方法觸發。 – 2015-02-18 14:08:43

回答

1

的iOS提供了內存不足的警告,當你的應用程序需要它認爲是太多RAM。

例如,在iPhone 4,它具有512 MB的RAM,操作系統會給你低內存警告,一旦你的應用程序越過256

粗略地講,將iOS版,如果你嘗試分配打攪你,無論其他應用佔用多少內存,該設備的RAM的一半以上。

+1

但我們正在使用50MB的iPad 512MB ...這遠遠低於256. – 2015-02-11 15:57:24

+0

我不知道碎片是否與此有關。你關閉並重新啓動iPad? (我敢打賭,你有)我四處尋找一個工具,我曾經發現,讓你分配內存,並顯示警告時發生...... – Almo 2015-02-11 16:06:07

+0

感謝您的提示。我不止一次地關閉了iPad ......但它沒有幫助。 – 2015-02-12 07:10:16

相關問題