@@ -17,31 +17,33 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
1717 func application( application: UIApplication , didFinishLaunchingWithOptions launchOptions: [ NSObject : AnyObject ] ? ) -> Bool {
1818 // Override point for customization after application launch.
1919
20+ switch ( application. applicationState) {
21+ case UIApplicationState . Active:
22+ print ( " didFinishLaunchingWithOptions - active " )
23+ case UIApplicationState . Inactive:
24+ print ( " didFinishLaunchingWithOptions - inactive " )
25+ case UIApplicationState . Background:
26+ print ( " didFinishLaunchingWithOptions - background " )
27+ }
28+
2029 let versionNumber : AnyObject ? = NSBundle . mainBundle ( ) . infoDictionary ? [ " CFBundleVersion " ]
2130 print ( " version \( versionNumber!) " )
2231
23- UIDevice . currentDevice ( ) . batteryMonitoringEnabled = true
24-
32+ // display initial startup message
2533 var item = NotificationData ( )
2634 item. alert = " Swift Push ( \( versionNumber!) ) starting on " + UIDevice. currentDevice ( ) . name
2735 notifications. insert ( item, atIndex: 0 )
2836
37+ // display an additional set of test messages
38+ /*
2939 let formatter = NSNumberFormatter()
3040 formatter.numberStyle = NSNumberFormatterStyle.SpellOutStyle
3141 for i in 1...10 {
3242 item = NotificationData()
3343 item.alert = "test data " + formatter.stringFromNumber(i)!
3444 notifications.insert(item, atIndex: 0)
3545 }
36-
37- switch ( application. applicationState) {
38- case UIApplicationState . Active:
39- print ( " didFinishLaunchingWithOptions - active " )
40- case UIApplicationState . Inactive:
41- print ( " didFinishLaunchingWithOptions - inactive " )
42- case UIApplicationState . Background:
43- print ( " didFinishLaunchingWithOptions - background " )
44- }
46+ */
4547
4648 let types : UIUserNotificationType =
4749 [ UIUserNotificationType . Alert, UIUserNotificationType . Badge, UIUserNotificationType . Sound]
@@ -55,6 +57,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
5557 let mainQueue = NSOperationQueue . mainQueue ( )
5658 NSNotificationCenter . defaultCenter ( ) . addObserverForName ( UIApplicationUserDidTakeScreenshotNotification, object: nil , queue: mainQueue) { notification in
5759 print ( " screenshot taken " )
60+ item = NotificationData ( )
61+ item. alert = " screenshot taken "
62+ item. timeStampSent = NSDate ( )
63+ notifications. insert ( item, atIndex: 0 )
5864 }
5965 return true
6066 }
0 commit comments