Advertisement
Esquilli

Sample code

May 15th, 2019
405
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void LisaActions(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) {
  2.     // Get notification name
  3.     NSString *notifName = (__bridge NSString*)name;
  4.  
  5.     if([notifName isEqualToString:@"com.apple.springboard.lockstate"])
  6.         // Track if locked or unlocked
  7.         lock = !lock;
  8.  
  9.     //do something
  10. }
  11.  
  12. %ctor {
  13. // CODE
  14. CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(),
  15.                                     NULL,
  16.                                     LisaActions,
  17.                                     CFSTR("com.apple.springboard.lockstate"),
  18.                                     NULL,
  19.                                     CFNotificationSuspensionBehaviorDeliverImmediately);
  20.  
  21. // CODE
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement