低内存警告总是导致iPad崩溃(第1代)

时间:2012-02-15 11:48:48

标签: ios ipad memory

我的第一代iPad(iOS 5.0.1)测试版之一抱怨不断崩溃。从描述给我们的方式来看,我们确信在设备收到低内存警告时会发生崩溃。

为了证明这一点,我们给了测试人员一个版本的版本,它没有足够的内存来驱动低内存警告,它工作正常。但这不是解决办法。

我们有20个第一代iPad作为beta测试者,但没有一个有同样的问题。

是否有可能在设备上设置可能导致低内存警告崩溃的内容?

iOS 5.0.1安装不正确吗?

有没有人知道为什么这个设备特别是在低内存警告而不是其他设备上崩溃?

非常感谢任何帮助, - 富有

2 个答案:

答案 0 :(得分:2)

可以肯定的是,您应该尝试从设备获取崩溃日志。测试人员必须将设备与iTunes同步,然后导航到iTunes复制任何崩溃报告的文件夹。这取决于您使用的平台。

Mac OS X: ~/Library/Logs/CrashReporter/MobileDevice/<DEVICE_NAME>
Windows XP: C:\Documents and Settings\<USERNAME>\Application Data\Apple Computer\Logs\CrashReporter\MobileDevice\<DEVICE_NAME>
Windows Vista or 7: C:\Users\<USERNAME>\AppData\Roaming\Apple Computer\Logs\CrashReporter\MobileDevice\<DEVICE_NAME>

<USERNAME>是用户的计算机登录名。 <DEVICE_NAME>是iPod touch或iPhone的名称,例如“我的iPhone”。

有多种方法可以自动收集崩溃报告,我在这里发布了可能性的概述,作为另一个答案的一部分:Including custom data into iOS crash dumps

此外,您可以在iOS模拟器中进行测试时自动执行内存警告。子类UIViewController并在视图控制器出现时自动触发内存警告。

以下是有关如何执行此操作的示例代码:

#import "BaseViewController.h"

@interface BaseViewController (Private)
- (void)simulateMemoryWarning;
@end

@implementation BaseViewController

- (void) viewDidAppear:(BOOL)animated {
  [super viewDidAppear:animated];

#if TARGET_IPHONE_SIMULATOR
#if defined (CONFIGURATION_Debug)
  // If we are running in the simulator and it's the DEBUG target
  // then simulate a memory warning. Note that the DEBUG flag isn't
  // defined by default. To define it add this Preprocessor Macro for
  // the Debug target: DEBUG=1
  [self simulateMemoryWarning];
#endif
#endif
}

- (void)simulateMemoryWarning {
#if TARGET_IPHONE_SIMULATOR
#if defined (CONFIGURATION_Debug)
  SEL memoryWarningSel = @selector(_performMemoryWarning);
  if ([[UIApplication sharedApplication] respondsToSelector:memoryWarningSel]) {
    [[UIApplication sharedApplication] performSelector:memoryWarningSel];
  } else {
    NSLog(@"%@",@"Whoops UIApplication no loger responds to -_performMemoryWarning");
  }
(CFStringRef)@"UISimulatedMemoryWarningNotification", NULL, NULL, true);
#endif
#endif
}

@end

现在在继承自己的视图控制器而不是从UIViewController进行子类化时使用它。此代码最初发布在此处https://gist.github.com/956403,并通过添加此处的解决方案进行调整以使用Xcode 4.2.1 https://stackoverflow.com/a/2785175/474794

答案 1 :(得分:1)

我是运行5.0.1的iPad 1用户,我一直有各种各样的应用程序(Safari,Dropbox,Pages,愤怒的小鸟,Spice Bandits等)。如果您想要崩溃日志,我很乐意提供您喜欢的数量。

我可以让游戏运行相当长的时间的唯一方法是关闭几乎所有额外的“服务”(电子邮件,通知,位置),然后重新启动设备。然后强制关闭所有进程。我已经恢复了设备并在5.1出现之前重新打开了所有设备。

如果你有一个特定的应用程序,你希望我测试我会很高兴。

我有一台iPad 3G 16GB

安德烈