简体   繁体   English

iOS 11 didRegisterForRemoteNotificationsWithDeviceToken未调用

[英]IOS 11 didRegisterForRemoteNotificationsWithDeviceToken not called

After calling registerForRemoteNotifications the appDelegate method didRegisterForRemoteNotificationsWithDeviceToken is not called. 调用registerForRemoteNotifications之后,未调用appDelegate方法didRegisterForRemoteNotificationsWithDeviceToken。 I don't receive a token from APNs so I cannot receive push notifications. 我没有收到来自APN的令牌,因此无法收到推送通知。

I see the 'Allow' pop up, but after selecting allow, I don't get the usual response from didRegisterForRemoteNotificationsWithDeviceToken. 我看到“允许”弹出,但是在选择允许之后,我没有从didRegisterForRemoteNotificationsWithDeviceToken得到通常的响应。

Everything used to work prior to IOS 11. 一切都可以在IOS 11之前运行。

Is anyone else experiencing the same issue? 还有其他人遇到同样的问题吗? There doesn't seem to be a lot of complaints about my issue. 关于我的问题似乎没有很多抱怨。

Has anything changed in IOS 11 as far as the APNs registration process? 对于APNs注册过程,IOS 11中是否有任何更改? Also didReceiveRemoteNotification in IOS 10 isn't working when the app is running in the background. 当应用程序在后台运行时,IOS 10中的didReceiveRemoteNotification也无法正常工作。

Ive searched high and low for a fix, but Push notifications are just broken for me at the moment for IOS 11. Ive在上下搜索了一个修复程序,但是对于IOS 11,推送通知对我而言只是一头雾水。

I have all the Info.plist data set correctly. 我已经正确设置了所有Info.plist数据。 I have all the switches set in the project settings. 我在项目设置中设置了所有开关。 I have tested previous versions of our app. 我已经测试了我们应用的早期版本。 I have created a bare bones project and it doesn't work either, just like our production app. 我创建了一个简单的项目,就像我们的生产应用程序一样,它也不起作用。 I'm assuming the registration code is the same as IOS 10. 我假设注册代码与IOS 10相同。

SOS please! 求救! Thanks. 谢谢。

In AppDelegate class method didFinishLaunchingWithOptions you have to use Code -- AppDelegate类方法didFinishLaunchingWithOptions您必须使用代码-

if( SYSTEM_VERSION_LESS_THAN( @"10.0" ) )
    {
        [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound |    UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
        [[UIApplication sharedApplication] registerForRemoteNotifications];

        if( optind != nil )
        {
            NSLog( @"registerForPushWithOptions:" );
        }
    }
    else
    {
        UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
        center.delegate = self;
        [center requestAuthorizationWithOptions:(UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge) completionHandler:^(BOOL granted, NSError * _Nullable error)
         {
             if( !error )
             {
                 [[UIApplication sharedApplication] registerForRemoteNotifications];  // required to get the app to do anything at all about push notifications
                 NSLog( @"Push registration success." );
             }
             else
             {
                 NSLog( @"Push registration FAILED" );
                 NSLog( @"ERROR: %@ - %@", error.localizedFailureReason, error.localizedDescription );
                 NSLog( @"SUGGESTIONS: %@ - %@", error.localizedRecoveryOptions, error.localizedRecoverySuggestion );
             }
         }];
    }

And Add the following framework - 并添加以下framework -

在此处输入图片说明

I tried this solution as well with no success. 我也尝试过此解决方案,但没有成功。

Our team actually solved the issue. 我们的团队实际上解决了这个问题。 A team member noticed didRegisterForRemoteNotificationsWithDeviceToken was working with Xcode 9 and IOS 11. 团队成员注意到didRegisterForRemoteNotificationsWithDeviceToken正在使用Xcode 9和IOS 11。

After simply plugging in my iPhone 6s plus device into his computer and running the app, the issue went away. 只需将我的iPhone 6s plus设备插入计算机并运行该应用程序,问题就消失了。

The device now receives didRegisterForRemoteNotificationsWithDeviceToken. 设备现在接收didRegisterForRemoteNotificationsWithDeviceToken。

I'm chalking this one up to some IOS update weirdness. 我把这归因于一些IOS更新的怪异之处。

Thanks for your help. 谢谢你的帮助。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在ios 9中没有调用didRegisterForRemoteNotificationsWithDeviceToken - didRegisterForRemoteNotificationsWithDeviceToken is not called up in ios 9 在iOS7上没有调用didRegisterForRemoteNotificationsWithDeviceToken - didRegisterForRemoteNotificationsWithDeviceToken not called on iOS7 iPhone 11 pro didRegisterForRemoteNotificationsWithDeviceToken 未调用 - iPhone 11 pro didRegisterForRemoteNotificationsWithDeviceToken not called didRegisterForRemoteNotificationsWithDeviceToken 未在 ios 10 上调用 - didRegisterForRemoteNotificationsWithDeviceToken not getting called on ios 10 应用程序:didRegisterForRemoteNotificationsWithDeviceToken:未称为ios 10.3.2 - application:didRegisterForRemoteNotificationsWithDeviceToken: not called ios 10.3.2 在iOS 8中未调出didRegisterForRemoteNotificationsWithDeviceToken - didRegisterForRemoteNotificationsWithDeviceToken is not called up in ios8 IOS 13 APNS didRegisterForRemoteNotificationsWithDeviceToken 未调用 - IOS 13 APNS didRegisterForRemoteNotificationsWithDeviceToken not called 没有使用简单的 iOS 应用程序调用 didRegisterForRemoteNotificationsWithDeviceToken - didRegisterForRemoteNotificationsWithDeviceToken not called with simple iOS app iOS 13.x didRegisterForRemoteNotificationsWithDeviceToken 从未被调用 - iOS 13.x didRegisterForRemoteNotificationsWithDeviceToken is never called 没有为 iOS 13 调用 didRegisterForRemoteNotificationsWithDeviceToken(目标 C) - didRegisterForRemoteNotificationsWithDeviceToken not called for iOS 13 (Objective C)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM