相关疑难解决方法(0)

为什么没有调用RegisterForRemoteNotificationsWithDeviceToken

我正在制作一个应用程序,我想在其中实现apple推送通知服务.我按照本教程中给出的分步说明进行操作.

但仍然没有调用这些方法.我不知道造成这个问题的原因.谁能帮我?

    - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { 
        //NSString * token = [[NSString alloc] initWithData:deviceTokenencoding:NSUTF8StringEncoding];
        NSString *str = [NSString stringWithFormat:@"Device Token=%@",deviceToken];
        NSLog(@"Device Token:%@",str);

        //NSLog(@"Device token is called");
        //const void *devTokenBytes = [deviceToken bytes];
        //NSLog(@"Device Token");
    }

    - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)err { 
        NSString *str = [NSString stringWithFormat: @"Error: %@", err];
        NSLog(@"Error:%@",str);    
    }
Run Code Online (Sandbox Code Playgroud)

objective-c apple-push-notifications

82
推荐指数
7
解决办法
8万
查看次数

ios中没有声音8 Parse push

这很奇怪,在更新我的应用程序以支持通过Parse发送的iOS 8推送通知(使用Parse仪表板)后,推送通知不会发出任何声音.

我在Stackoverflow上发现了这个重复,但是发布的答案对我不起作用:ios8的Parse推送通知中没有声音

  • 我已经检查了通知中心,并启用了消息和声音.
  • 创建了一个新的应用程序清洁版本
  • 检查其他推送消息是否在应用程序上发出声音
  • 使用Parse rest api并将声音设置为默认值.

我尝试过的所有事情都没有.

使用解析代码更新了我的应用:

// Register for Push Notitications, if running iOS 8
if ([application respondsToSelector:@selector(registerUserNotificationSettings:)]) {
    UIUserNotificationType userNotificationTypes = (UIUserNotificationTypeAlert |
                                                    UIUserNotificationTypeBadge |
                                                    UIUserNotificationTypeSound);
    UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:userNotificationTypes
                                                                             categories:nil];
    [application registerUserNotificationSettings:settings];
    [application registerForRemoteNotifications];

} else {
    // Register for Push Notifications before iOS 8
    [application registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge |
                                                     UIRemoteNotificationTypeAlert |
                                                     UIRemoteNotificationTypeSound)];
}
Run Code Online (Sandbox Code Playgroud)

编辑:我在Facebook开发者发现了一个惊人的错误报告:https://developers.facebook.com/bugs/719233564823090/

xcode push-notification apple-push-notifications ios parse-platform

5
推荐指数
1
解决办法
2612
查看次数