メモリ不足の警告に応答できるようにしたい「静的」のようなクラスがあります。ただし、シミュレーターからメモリ不足の警告を手動でトリガーすると、「認識されないセレクター」エラーが発生します。
関連コード:
@interface MyClass : NSObject
+ (void) receiveNotification:(NSNotification*) notification;
@end
@implementation MyClass
+ (void) initialize {
[super initialize];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveNotification) name:@"UIApplicationDidReceiveMemoryWarningNotification" object:nil];
}
+ (void) receiveNotification:(NSNotification*) notification {
// Breakpoint here never hits.
// I instead receive error "+[MyClass receiveNotification]: unrecognized selector sent to class".
}
@end