/ Published in: C
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
- (BOOL) isActiveUser { NSDictionary *sessionInfo = (NSDictionary *) CGSessionCopyCurrentDictionary(); NSString *shortUserName = [sessionInfo valueForKey:kCGSessionUserNameKey]; NSString *userUID = [sessionInfo valueForKey:kCGSessionUserIDKey]; BOOL userIsActive = [[sessionInfo valueForKey:kCGSessionOnConsoleKey] boolValue]; NSString *loginCompleted = [sessionInfo valueForKey:kCGSessionLoginDoneKey]; NSLog(@"Session information: %@", sessionInfo); return userIsActive; }