警告收到内存警告。等级= 2 iPhone

时间:2011-09-22 14:44:06

标签: iphone

我的应用程序崩溃显示

Received memory warning. Level=2. 

完整警告

warning: Unable to read symbols for /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.3.5 (8L1)/Symbols/Developer/usr/lib/libXcodeDebuggerSupport.dylib (file not found).

请帮忙

它在iphone模拟器中工作正常,但实际上没有工作

2 个答案:

答案 0 :(得分:3)

这不只是一个记忆问题吗? iPad和iPhone的“RAM”非常有限,如果您使用太多,系统将发送1级警告和2级警告。如果你之后仍然使用太多内存,它将会终止你的应用程序。

您在模拟器上没有遇到问题,因为您的计算机有更多内存。

如果要模拟此类内存警告,请查看代码在这种情况下的行为方式。使用此代码:

// Do as if there has been a memory warning in the simulator
+ (void)simulateMemoryWarningInSimulator
{
     #if TARGET_IPHONE_SIMULATOR
    #ifdef DEBUG
        CFNotificationCenterPostNotification(CFNotificationCenterGetDarwinNotifyCenter(), (CFStringRef)@"UISimulatedMemoryWarningNotification", NULL, NULL, true);
    #endif
    #endif
}

答案 1 :(得分:0)

尝试在xcode项目中添加此框架 - libxml.dylib

是的,如果它看起来像内存问题,请在配有Instruments的设备上运行您的应用。它应该告诉你究竟是什么导致了内存问题。

相关问题