My app has :
APP ID - push-notification enabled,
Provision Profile (Development) - push-notification enabled,
Target - capabilities - push-notification enabled,
Target - background mode - background fetch, remote notification enabled
In Appdelegate
1.import UserNotifications
2.class AppDelegate: UIResponder, UIApplicationDelegate, UINavigationControllerDelegate, UNUserNotificationCenterDelegate
3.
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
if #available(iOS 10.0, *)
{
let center = UNUserNotificationCenter.current()
center.delegate = self
center.requestAuthorization(options: [.badge, .sound, .alert], completionHandler: { (granted, error) in
if error == nil
{
//UIApplication.shared.registerForRemoteNotifications()
application.registerForRemoteNotifications()
}
else
{
print("\(error?.localizedDescription)")
}
})
}
else
{
registerForPushNotifications(application)
// Fallback on earlier versions
}
}
but didRegisterForRemoteNotificationsWithDeviceToken is not get called instead didFailToRegisterForRemoteNotificationsWithError is getting call
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
Following error I'm getting at didFailToRegisterForRemoteNotificationsWithError
Domain=NSCocoaErrorDomain Code=3000 "no valid 'aps-environment' entitlement string found for application" UserInfo={NSLocalizedDescription=no valid 'aps-environment' entitlement string found for application}
Is I am missing something?


