당신은이 같은 NSDistributedNotificationCenter
사용할 수 있습니다 모든 분산 통지에 가입이 바로 그 순간에 발생하는 사람을 찾아별로 단계적으로 감소하는 것이
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
[[NSDistributedNotificationCenter defaultCenter] addObserverForName:@"com.apple.sessionDidMoveOffConsole" object:nil queue:nil usingBlock:^(NSNotification *note) {
NSLog(@"user inactive");
}];
[[NSDistributedNotificationCenter defaultCenter] addObserverForName:@"com.apple.sessionDidMoveOnConsole" object:nil queue:nil usingBlock:^(NSNotification *note) {
NSLog(@"user active");
}];
}
편집
내가 찾은를 나머지 두 사람에게.
나는 문제없이 작동 할 것임을 100 % 확신합니다. 이 문서를 찾을 수 없으므로 테스트 테스트를 테스트하고 엣지 케이스를 검색해야 할 수도 있습니다.
줄리안에게 감사드립니다. 이것은 내가 찾고있는 것입니다 ... –
@FaisalIkwal : 환영합니다! 내가 도와 줄 수있어서 좋았어. 제 편집문을 읽어주세요. 이것은 공식적으로 문서화 된 변종이 아니므로, 우리는 엣지 경우를 모른다. –
그러나 인터넷 검색이 빠른 사용자 전환을 제외하고는 아무 것도하지 못했기 때문에 정상적으로 작동 할 것입니다. –