code style

顯示具有 tips 標籤的文章。 顯示所有文章
顯示具有 tips 標籤的文章。 顯示所有文章

9/03/2015

How to induce low memory warnings on iOS device?

It's difficult to test game function in low memory scenario.

Someone suggests using iOS simulator to do the test.

Someone says write codes to allocate large chunk of memory to induce that, or call private method
[[UIApplication sharedApplication] performSelector:@selector(_performMemoryWarning)];

Rather than writing code in the project, you could use Xcode debugger to execute the private function.

Edit the action of breakpoint and enter
expr (void)[[UIApplication sharedApplication] performSelector:@selector(_performMemoryWarning)];
Voilà, mission completed.

By the way, my indie game "Nimble Jump" Android version is in beta testing now.
Please try it and give some feedback. Thank you!
play.google.com/apps/testing/com.jbyu.ninja.