didreceivememorywarning 上的适当的低内存警告消息!
我的应用程序中经常收到内存不足警告,我重写 didreceivememorywarninig 方法并尽力释放不需要的自定义对象。
通常,当多个应用程序在后台运行时(6到7个应用程序),我会收到内存警告,因此我想通知用户关闭一些后台应用程序,这可能有助于顺利运行我的应用程序。
//警告消息:
//警告:内存不足。关闭其他应用程序可能会有所帮助。
-(void)applicationDidReceiveMemoryWarning:(UIApplication *)application
{
NSString *WarningMessage = [NSString stringWithString:@"Warning: You are running low on memory. Closing other applications might help."];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"MyApp" message:WarningMessage delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
[alert show];
[alert release];
}
苹果会接受这种行为吗??? 谢谢。
I got frequently low memory warning in my app, i override didreceivememorywarninig method and tried my best to release unwanted custom objects.
Usually i got the memory warnings when multiple application running in background ( 6 to 7 apps) so i want to inform users to close some background app that might help to run my app smoothly.
//Warning message:
//Warning: You are running low on memory. Closing other applications might help.
-(void)applicationDidReceiveMemoryWarning:(UIApplication *)application
{
NSString *WarningMessage = [NSString stringWithString:@"Warning: You are running low on memory. Closing other applications might help."];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"MyApp" message:WarningMessage delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
[alert show];
[alert release];
}
Will apple accept this behavior ????
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
好问题,但我不认为苹果有任何理由不接受这个......
good question, but I don't see any reason why apple should not accept this...
我不确定你是否应该建议这一点。无论如何,iOS 都会清除它们。您应该只处理您的应用程序的情况。
I am not sure if you should be suggesting that. iOS is going to purge them anyway. You should just handle the situation for your app.
这绝对是一个愚蠢的想法。它会让用户感到困惑并产生糟糕的用户体验。
您缺少的是,您在后台时收到低内存警告并最终被杀死是故意的。其他应用程序经历完全相同的行为。但好处是,如果您在转换到后台时做了正确的事情,用户就不会注意到这一点。对于用户来说,似乎所有这些应用程序仍在运行。例如,在后台接收通知的应用程序仍然会收到它们,即使它们被杀死。当他们点击您的应用程序时,它会从他们离开的地方重新开始。
如果用户手动终止应用程序,所有这些精心设计的行为都会被破坏。未收到通知。当用户点击应用程序时,用户会丢失应用程序中上次中断的位置,但会从头开始。我预计如果苹果发现你在做什么,他们会拒绝你的应用程序,因为你没有给任何人带来任何好处。
It's an absolutely daft idea. It will confuse users and produce a bad user experience.
What you are missing is that it is intentional that you receive low memory warnings and eventually get killed when in the background. The other applications experience exactly the same behaviour. But the good thing is that if you did the right things when transitioning to the background, this will be not noticed by the user. To the user, it looks as if all these applications are still running. For example, apps receiving notifications in the background will still receive them, even when they are killed. And when they tap on your app, it starts again exactly where they left.
If the user manually kills an application, all this carefully designed behaviour is destroyed. Notifications are not received. The user loses the place in the application where they left off but start again from scratch when tapping the app. I would expect that Apple would reject your app if they find out what you are doing, because you aren't doing anyone any favours.