objective-c - 将 VOIP 通知负载转换为字符串
问题描述
我正在尝试在我的应用程序中调试 VOIP 通知,但无法使用开发人员模式进行调试。当我收到通知时,我必须使用呼叫者详细信息和信息致电我的 VOIP 客户端。如何将此数据转换为字符串,类似于JSON.stringify
javascript 中的内容?这是我的代码
// Handle incoming pushes
- (void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(PKPushType)type withCompletionHandler:(void (^)(void))completion {
// Process the received push
[RNVoipPushNotificationManager didReceiveIncomingPushWithPayload:payload forType:(NSString *)type];
// Need to extract caller name and other details from VOIP notification payload to store into handle and callerName
// Maybe can convert payload to string and assigning it to handle for checking it's structure
NSString *handle = @"ateev"; // hardcoded
NSString *uuid = [[NSUUID UUID] UUIDString];
NSString *callerName = @"ateev"; // hardcoded
// NSString *handle = @"caller number here";
[RNCallKeep reportNewIncomingCall: uuid
handle: handle
handleType: @"generic"
hasVideo: NO
localizedCallerName: callerName
supportsHolding: YES
supportsDTMF: YES
supportsGrouping: YES
supportsUngrouping: YES
fromPushKit: YES
payload: nil
withCompletionHandler: completion];
completion();
}
解决方案
推荐阅读
- java - 通过导航器而不是 java 传递 json 对象
- javascript - 强制刷新砌体网格
- javascript - How to I use my firebase variables as an integer?
- windows - 如何使用 VB.net 以编程方式获取当前在 VLC 中播放的视频文件
- reactjs - 类型“TodosState”不是数组类型。ts(2461)
- excel - 设置 X 轴的最小值
- python - 收敛到不同的优化结果
- html - 如何将 .css 文件连接到保存页面时 html 代码消失的 wikipage?
- vim - 如何使用 neovim 从 Rmarkdown 自动生成 pdf?
- npm - VSCode 调试和玩笑:使用 npm 运行没有断点,使用节点运行 CWD 错误