I'm new to make iPhone App with Objective-c
I want to make the App which sends a notification when iPhone screen is locked(Pressed Lock button) How can I make this app?
I'm trying to make it using "applicationWillSuspend", but
/*----------------------------------------*/
- (void)applicationWillSuspend
{
     NSLog(@"WillSuspend");
}
/*----------------------------------------*/
This code doesn't work
I'm not sure when applicationWillSuspend is called
Please, give me some knowledge
#import "AppDelegate.h"
#import <notify.h>
@interface AppDelegate ()
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    // iOS8 Notification permit
    if ([UIApplication
         instancesRespondToSelector:@selector(registerUserNotificationSettings:)]) {
        [[UIApplication sharedApplication]
         registerUserNotificationSettings:[UIUserNotificationSettings
                                           settingsForTypes:UIUserNotificationTypeAlert|UIUserNotificationTypeSound
                                           categories:nil]];
    }
    return YES;
    int notify_token;
    notify_register_dispatch("com.apple.springboard.lockstate",
                             ¬ify_token,
                             dispatch_get_main_queue(),
                             ^(int token)
                             {
                                 uint64_t state = UINT64_MAX;
                                 notify_get_state(token, &state);
                                 if(state == 0) {
                                     NSLog(@"unlock device");
                                 } else {
                                     NSLog(@"lock device");
                                 }
                             }
                             );
}