A frequently asked question on StackOverflow.net:
I'd like to test my app functions well in low memory conditions, but it's difficult to test. How can I induce low memory warnings that trigger the
didReceiveMemoryWarning
orapplicationDidReceiveMemoryWarning:
method in my ViewControllers or AppDelegate when the app is running on the real device, NOT the simulator? Or what are some ways I can test my app under these possible conditions?
The reason I can't use the simulator is my app uses Game Center and invites don't work on the simulator.
Okay, this tool simulates iOS on-device memory warnings like a hero.
-
It induces memory warnings through pressing the physical volume button on iOS devices
-
It works transparently. In other words, to use AllYourMemoriesAreBelong2iOS, you need just linking this framework into your app and hit the
Run
button to build and then run the Debug scheme. You will never be asked to configure anything and the debug codes in this framework will never be shipped in releasing version -
It supports hot-swapability for KVOController from Facebook. In other words, if your app has linked KVOController.framework, the internal mechanism of AllYourMemoriesAreBelong2iOS would take advantage of it, otherwise the raw KVO API would be applied instead
-
Clone and incorporate this repo into your project with
git submodule
:git submodule add https://github.com/TorinKwok/AllYourMemoriesAreBelong2iOS.git ${YOUR_DIR} --recursive
-
Hit
File
->Add Files to "${YOUR_PROJECT_NAME}"
item in Xcode menu bar, then choose theAllYourMemoriesAreBelong2iOS.xcodeproj
-
Link AllYourMemoriesAreBelong2iOS in
General
panel -
Make sure build and run your project in Debug scheme. AllYourMemoriesAreBelong2iOS includes the invocation of Apple private API, its implementation was masked in releasing version as it will be rejected by Apple
-
Press physical volume button on your iOS devices to induce the system memory warnings. You will want to process those notifications in
didReceiveMemoryWarning
orapplicationDidReceiveMemoryWarning:
method in the ViewControllers or AppDelegate
Torin Kwok.
- Email:
dG9yaW5Aa3dvay5pbQ==
(base64ed) - OpenPGP/GnuPG: fetch pub key
- GitHub: @TorinKwok
AllYourMemoriesAreBelong2iOS by Torin Kwok is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.