在WWDC 2013的"多任务新功能"演示中,有一个关于静音推送通知的部分.看起来很简单.根据演示文稿,如果您将APS有效负载仅发送到内容可用设置为1,则不会通知用户该通知.
// A. This doesn't work
{
aps: {
content-available: 1
}
}
Run Code Online (Sandbox Code Playgroud)
我的测试显示,这不起作用,因为没有收到推送.但是,如果我包含声音属性但排除了alert属性,它就会起作用(虽然不再是静音).
// B. This works
{
aps: {
content-available: 1,
sound: "default"
}
}
Run Code Online (Sandbox Code Playgroud)
但是,如果我更改声音属性以播放静音,我可以模仿静音.
// C. This works too.
{
aps: {
content-available: 1,
sound: "silence.wav"
}
}
Run Code Online (Sandbox Code Playgroud)
有人知道吗:
提前致谢.
编辑更多信息
对于A,应用程序的状态无关紧要.从未收到通知.
看起来B和C只有在将属性和值括在引号中时才有效,如下所示.
{"aps":{"content-available": 1, "sound":"silent.wav"}}
Run Code Online (Sandbox Code Playgroud)
并且通知到达应用程序:didReceiveRemoteNotification:fetchCompletionHandler:无论状态如何.
我有一个使用AudioUnit的VOIP应用程序.在iOS 9上,我看到一条错误消息,说明如下.我在iOS 8中没有看到这个:
mediaserverd [43]:13:16:38.880错误:[0x1f72d000]> va> 500:错误'什么'获取物理格式的客户端格式[16/44100/2; flags:0xc; bytes/packet:4; 帧/包:1; bytes/frame:4; ]
有谁知道这意味着什么?音频似乎工作正常,但我仍然有点厌烦,如果可以,我想解决它.我的AudioUnit设置代码如下.帮助赞赏.谢谢.
CheckError(NewAUGraph(&audioState.graph), "NewAUGraph failed");
AUNode rioNode;
AudioComponentDescription desc;
desc.componentType = kAudioUnitType_Output;
desc.componentSubType = kAudioUnitSubType_VoiceProcessingIO;
desc.componentFlags = 0; // Documentation states "Set this value to zero"
desc.componentFlagsMask = 0; // Documentation states "Set this value to zero"
desc.componentManufacturer = kAudioUnitManufacturer_Apple;
CheckError(AUGraphAddNode(audioState.graph, &desc, &rioNode), "AUGraphAddNode failed for RIO");
CheckError(AUGraphOpen(audioState.graph),"Failed to open graph");
CheckError(AUGraphNodeInfo(audioState.graph, rioNode, NULL, &audioState.rio),"Failed to get rio node info");
UInt32 flag = 1;
CheckError(AudioUnitSetProperty(audioState.rio,
kAudioOutputUnitProperty_EnableIO,
kAudioUnitScope_Input,
1,
&flag, …Run Code Online (Sandbox Code Playgroud) 我一直在使用私有API(不在App Store上供个人使用)来阻止传入呼叫使用此Stackoverflow帖子中列出的步骤如何使用私有API来阻止iOS应用程序中的传入呼叫?
我最近升级到iOS 7,发现它不再起作用了.收到来电时,我仍然收到"kCTCallIdentificationChangeNotification"通知,但是当我调用CTCallDisconnect函数时,它什么也没做.
当我在CoreTelephony库上执行"nm"命令时,它仍会列出CTCallDisconnect函数,因此它看起来仍然存在于iOS 7中.
在iOS 7中拒绝接听来电有没有运气?
谢谢!
我无法重现此错误,但是我的一位用户因以下错误而崩溃(在iOS 11上)。
Fatal Exception: NSInternalInconsistencyException
Invalid parameter not satisfying: bundleProxy != nil
Run Code Online (Sandbox Code Playgroud)
调用以下代码段时:
[[UNUserNotificationCenter currentNotificationCenter]
requestAuthorizationWithOptions:
(UNAuthorizationOptionAlert |
UNAuthorizationOptionBadge |
UNAuthorizationOptionSound)
completionHandler:
^(BOOL granted, NSError * _Nullable error) {
if (granted) {
[self getNotificationSettings];
}
}];
Run Code Online (Sandbox Code Playgroud)
我无法自己复制它。而且我在这里或网上找不到任何类似的东西。有没有其他人碰到这个可以阐明一些观点的人?