小编Ome*_*jua的帖子

iOS 8.1推送通知无声音

该设备在iOS 8.1上运行

我正在使用xCode 6.1来编译应用程序.

这是注册推送的代码

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
{
    [application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
    [application registerForRemoteNotifications];
}
else
{
    [application registerForRemoteNotificationTypes: (UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)];
}
Run Code Online (Sandbox Code Playgroud)

它可以在应用程序向服务器注册时正常工作.

PEM文件也正确完成,因为我可以使用沙盒APN将推送发送到我的设备.

当我打印我的JSON有效负载时,didReceiveRemoteNotification我得到这个:

{
    aps =     {
        alert = "Test Push Message";
    };
}
Run Code Online (Sandbox Code Playgroud)

问题是当我收到推送时(即使设备设置为响亮)它也不会发出声音.

据我所知,如果你没有在JSON有效载荷中指定声音,它应该播放默认的OS声音.

在手机上的应用程序通知设置中,默认情况下启用声音,因为当我注册时,我指定了UIUserNotificationTypeSound.

其他人遇到过这个问题?

audio push-notification ios

15
推荐指数
2
解决办法
2万
查看次数

有没有办法在c中的另一个#define中进行#define?

我希望实现与方法相同的功能stringWithFormat.

我想知道你是否可以打电话给我的另一个常数#define

例如 [NSString stringWithFormat:@"If you enjoyed %@ would you mind please reviewing it?", appName];

我想要:

#define appName @"This App"

#define myMessage @"If you enjoyed **appName** would you mind please reviewing it?"
Run Code Online (Sandbox Code Playgroud)

谢谢

c objective-c

0
推荐指数
1
解决办法
124
查看次数

标签 统计

audio ×1

c ×1

ios ×1

objective-c ×1

push-notification ×1