iOS에서 Memory Warning 테스트
3503 단어 iOS
didReceiveMemoryWarning
할 때의 노트.Memory Warning 생성
시뮬레이터
iOS Simultor 메뉴에서
Hardware -> Simulate Memory Warning
재현 가능합니다.
단축키는 [command] + [shift] + M입니다.
실기
다음 privete API를 사용할 수 있습니다.
someFile.m
[[UIApplication sharedApplication] performSelector:@selector(_performMemoryWarning)];
Memory Warning 캡처
각각 Memory Warning입니다.
- AppDelegate
- ViewController
- UIApplicationDidReceiveMemoryWarningNotification
포착할 수 있습니다.
AppDelegate.m
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application
{
NSLog(@"applicationDidReceiveMemoryWarning");
}
ViewController.m- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
NSLog(@"didReceiveMemoryWarning");
}
someFile.m- (void)someFunction
{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleMemoryWarning:) name:UIApplicationDidReceiveMemoryWarningNotification object:nil];
}
- (void) handleMemoryWarning:(NSNotification *)notification
{
NSLog(@"handleMemoryWarning");
}
이상
Reference
이 문제에 관하여(iOS에서 Memory Warning 테스트), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/jollyjoester/items/3b0dd17538ea5faecc4d텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)