Push notification 推送令牌';s delegte方法在ios 12.4.5版iPhone 5s中未特别调用
我在我的应用程序中集成了VoIP和远程通知,但具体来说,是在iPhone 5s和ios 12.4.5中。我确实得到了VoIP令牌或远程令牌。UIApplicationDelegate的toke方法和PKPushRegistryDelegate的token方法未调用。这里出了什么问题?我已经尝试使用强大的蜂窝网络,而不是使用wifi连接。iPhone的其他变体,如iPhone 6和iPhone XR,工作正常。请帮我解决这个问题 我使用了一个推送通知证书,下面提到了远程推送和VoIP推送 这是我的密码Push notification 推送令牌';s delegte方法在ios 12.4.5版iPhone 5s中未特别调用,push-notification,ios12,iphone-5,Push Notification,Ios12,Iphone 5,我在我的应用程序中集成了VoIP和远程通知,但具体来说,是在iPhone 5s和ios 12.4.5中。我确实得到了VoIP令牌或远程令牌。UIApplicationDelegate的toke方法和PKPushRegistryDelegate的token方法未调用。这里出了什么问题?我已经尝试使用强大的蜂窝网络,而不是使用wifi连接。iPhone的其他变体,如iPhone 6和iPhone XR,工作正常。请帮我解决这个问题 我使用了一个推送通知证书,下面提到了远程推送和VoIP推送 这是我
@interface AppDelegate : UIResponder <UIApplicationDelegate,PKPushRegistryDelegate,UNUserNotificationCenterDelegate>
{
PKPushRegistry *voipRegistry;
}
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[self pushNotificationRegister];
return true;
}
-(void)pushNotificationRegister
{
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
UNAuthorizationOptions options = UNAuthorizationOptionAlert + UNAuthorizationOptionSound + UNAuthorizationOptionBadge;
center.delegate = self;
[center requestAuthorizationWithOptions:options completionHandler:^(BOOL granted, NSError * _Nullable error){
if( !error ){
dispatch_async(dispatch_get_main_queue(), ^{
[self voipRegistration];
[UIApplication.sharedApplication registerForRemoteNotifications];
});
}
}];
[center getNotificationSettingsWithCompletionHandler:^(UNNotificationSettings * _Nonnull settings) {
if (settings.authorizationStatus != UNAuthorizationStatusAuthorized) {
}
}];
}
- (void) voipRegistration
{
voipRegistry = [[PKPushRegistry alloc] initWithQueue: dispatch_get_main_queue()];
voipRegistry.desiredPushTypes = [NSSet setWithObject:PKPushTypeVoIP];
voipRegistry.delegate = self;
}
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
// Not invoke
}
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
// Not invoke
}
- (void)pushRegistry:(PKPushRegistry *)registry didUpdatePushCredentials:(PKPushCredentials *)pushCredentials forType:(PKPushType)type
{
// Not invoke
}
- (void)pushRegistry:(PKPushRegistry *)registry didInvalidatePushTokenForType:(PKPushType)type
{
// Not invoke
}
- (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler
{
completionHandler(UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionBadge | UNNotificationPresentationOptionSound);
}
- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)(void))completionHandler
{
completionHandler();
}
@end
@接口AppDelegate:UIResponder
{
PKPushRegistry*voipRegistry;
}
@实现AppDelegate
-(BOOL)应用程序:(UIApplication*)应用程序使用选项完成启动:(NSDictionary*)启动选项
{
[自动推送通知寄存器];
返回true;
}
-(作废)推送通知登记簿
{
UNUserNotificationCenter*中心=[UNUserNotificationCenter currentNotificationCenter];
未授权选项选项=未授权选项ERT+未授权选项声音+未授权选项徽章;
center.delegate=self;
[center requestAuthorizationWithOptions:options completionHandler:^(已授予布尔,N错误*_可为空错误){
如果(!错误){
dispatch\u async(dispatch\u get\u main\u queue()^{
[自行注册];
[UIApplication.sharedApplication RegisterforRemotonifications];
});
}
}];
[中心getNotificationSettingsWithCompletionHandler:^(未通知设置*_非空设置){
if(settings.authorizationStatus!=未授权状态已授权){
}
}];
}
-(无效)登记
{
voipRegistry=[[PKPushRegistry alloc]initWithQueue:dispatch_get_main_queue()];
voipRegistry.desiredPushTypes=[NSSet setWithObject:PKPushTypeVoIP];
voipRegistry.delegate=self;
}
-(无效)应用程序:(UIApplication*)应用程序DIdRegisterForRemotionTificationswithDeviceToken:(NSData*)deviceToken
{
//不调用
}
-(无效)应用程序:(UIApplication*)应用程序未能注册远程通知,错误为:(N错误*)错误
{
//不调用
}
-(void)pushRegistry:(PKPushRegistry*)注册表didUpdatePushCredentials:(PKPushCredentials*)pushCredentials forType:(PKPushType)类型
{
//不调用
}
-(void)pushRegistry:(PKPushRegistry*)注册表didInvalidatePushTokenForType:(PKPushType)类型
{
//不调用
}
-(void)userNotificationCenter:(UNUserNotificationCenter*)中心将使用completionHandler:(void(^)(UNNotificationPresentationOptions))completionHandler呈现通知:(UNNotification*)通知
{
完成处理程序(UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionBadge | UNNotificationPresentationOptionSound);
}
-(void)userNotificationCenter:(UNUserNotificationCenter*)center未收到NotificationResponse:(UNNotificationResponse*)带有completionHandler的响应:(void(^)(void))completionHandler
{
completionHandler();
}
@结束
这里也有同样的问题。。。我正在浪费很多时间调试这个。这里也有同样的问题。。。我正在浪费很多时间调试这个。