{"action":"created","issue":{"url":"https://api.github.com/repos/AppGyver/PushNotifications/issues/21","labels_url":"https://api.github.com/repos/AppGyver/PushNotifications/issues/21/labels{/name}","comments_url":"https://api.github.com/repos/AppGyver/PushNotifications/issues/21/comments","events_url":"https://api.github.com/repos/AppGyver/PushNotifications/issues/21/events","html_url":"https://github.com/AppGyver/PushNotifications/issues/21","id":63433614,"number":21,"title":"Push notifications are not enabled for this app","user":{"login":"lyonsrob","id":5414417,"avatar_url":"https://avatars.githubusercontent.com/u/5414417?v=3","gravatar_id":"","url":"https://api.github.com/users/lyonsrob","html_url":"https://github.com/lyonsrob","followers_url":"https://api.github.com/users/lyonsrob/followers","following_url":"https://api.github.com/users/lyonsrob/following{/other_user}","gists_url":"https://api.github.com/users/lyonsrob/gists{/gist_id}","starred_url":"https://api.github.com/users/lyonsrob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lyonsrob/subscriptions","organizations_url":"https://api.github.com/users/lyonsrob/orgs","repos_url":"https://api.github.com/users/lyonsrob/repos","events_url":"https://api.github.com/users/lyonsrob/events{/privacy}","received_events_url":"https://api.github.com/users/lyonsrob/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-21T17:36:58Z","updated_at":"2015-03-25T02:25:41Z","closed_at":"2015-03-25T02:25:41Z","body":"My app is signed with what I believe is the correct provisioning profile for allowing push notifications. I can get the app to consistently prompt the user to allow push, but after I always get this message: \r\n\r\n```\r\nsupersonic.device.push.register rejected: \\\"Push notifications are not enabled for this app.\\\"\r\n```\r\n\r\nDigging into the plugin code the only reason that message displays is if this check evaluates to false\r\n\r\n```\r\nif(![[NotificationService instance] notificationsEnabled]){\r\nCDVPluginResult commandResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@”Push notifications are not enabled for this app.\"];\r\n[plugin.commandDelegate sendPluginResult:commandResult callbackId:registerCallBack.callbackId];\r\n}\r\n```\r\n\r\nI have ios 8.2 installed, so I assume my device is running this code from notificationsEnabled\r\n\r\n```\r\n// Try to use the newer isRegisteredForRemoteNotifications otherwise use the enabledRemoteNotificationTypes.\r\nif ([application respondsToSelector:@selector(isRegisteredForRemoteNotifications)])\r\n{\r\nenabled = [application isRegisteredForRemoteNotifications];\r\n}\r\n```\r\n\r\nisRegisteredForRemoteNotifications, according to the apple docs at https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplication_Class/#//apple_ref/occ/instm/UIApplication/registerForRemoteNotifications, should return YES if the app has been registered for settings. \r\n\r\nLooking further at the plugin code, registerForRemoteNotifications seems to only be called inside didRegisterUserNotificationSettings\r\n\r\n```\r\n-(void) didRegisterUserNotificationSettings:(UIUserNotificationSettings )settings {\r\nif ([settings types] != UIUserNotificationTypeNone) {\r\n[[UIApplication sharedApplication] registerForRemoteNotifications];\r\n} else {\r\n[self notifyRegistrationToAllWebViews];\r\n}\r\n}\r\n```\r\n\r\nWhich, looping back to my original concern appears to check if user notifications are in the apps settings. Which, I've only ever been able to make appear for a brief moment one time amongst 30 different app installs."},"comment":{"url":"https://api.github.com/repos/AppGyver/PushNotifications/issues/comments/85790151","html_url":"https://github.com/AppGyver/PushNotifications/issues/21#issuecomment-85790151","issue_url":"https://api.github.com/repos/AppGyver/PushNotifications/issues/21","id":85790151,"user":{"login":"lyonsrob","id":5414417,"avatar_url":"https://avatars.githubusercontent.com/u/5414417?v=3","gravatar_id":"","url":"https://api.github.com/users/lyonsrob","html_url":"https://github.com/lyonsrob","followers_url":"https://api.github.com/users/lyonsrob/followers","following_url":"https://api.github.com/users/lyonsrob/following{/other_user}","gists_url":"https://api.github.com/users/lyonsrob/gists{/gist_id}","starred_url":"https://api.github.com/users/lyonsrob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lyonsrob/subscriptions","organizations_url":"https://api.github.com/users/lyonsrob/orgs","repos_url":"https://api.github.com/users/lyonsrob/repos","events_url":"https://api.github.com/users/lyonsrob/events{/privacy}","received_events_url":"https://api.github.com/users/lyonsrob/received_events","type":"User","site_admin":false},"created_at":"2015-03-25T02:25:41Z","updated_at":"2015-03-25T02:25:41Z","body":"I have seemingly solved the issue for now. Somehow calling supersonic.device.push.register() breaks push notifications. Going back to the register method in the examples works after resetting the date/time on the phone and registering again. "}}