• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

ios - 收到 Voip Push 后崩溃

[复制链接]
菜鸟教程小白 发表于 2022-12-13 14:18:27 | 显示全部楼层 |阅读模式 打印 上一主题 下一主题

在测试 Voip Pushes 时遇到了这个错误

2016-10-19 14:03:26.809 linphone[332:33741] Can't endBackgroundTask: no background task exists with identifier c6, or it may have already been ended. Break in UIApplicationEndBackgroundTaskError() to debug.
Oct 19 14:03:26  linphone[332] <Notice>: ios/(honeAppDelegate.m:492 ) PushKit received with payload : <KPushPayload: 0x14ee5b30>
Oct 19 14:03:26  linphone[332] <Notice>: ios/(honeAppDelegate.m:494 ) incoming voip notfication: {
        aps =     {
            alert = Testando;
        };
    } 
2016-10-19 14:03:26.818 linphone[332:33741] -[__NSCFString objectForKey:]: unrecognized selector sent to instance 0x18e5c760
2016-10-19 14:03:26.821 linphone[332:33741] Crash: -[__NSCFString objectForKey:]: unrecognized selector sent to instance 0x18e5c760
2016-10-19 14:03:26.902 linphone[332:33741] Stack Trace: (
    0   CoreFoundation                      0x24bff933 <redacted> + 150
    1   libobjc.A.dylib                     0x2439ae17 objc_exception_throw + 38
    2   CoreFoundation                      0x24c052b5 <redacted> + 0
    3   CoreFoundation                      0x24c02ee1 <redacted> + 700
    4   CoreFoundation                      0x24b2e238 _CF_forwarding_prep_0 + 24
    5   linphone                            0x0002ee2f -[LinphoneAppDelegate processRemoteNotification:] + 214
    6   linphone                            0x00030f15 __78-[LinphoneAppDelegate pushRegistry:didReceiveIncomingPushWithPayload:forType:]_block_invoke_2 + 96
    7   libdispatch.dylib                   0x012ddb7f _dispatch_call_block_and_release + 10
    8   libdispatch.dylib                   0x012ddb6b _dispatch_client_callout + 22
    9   libdispatch.dylib                   0x012e2655 _dispatch_main_queue_callback_4CF + 1680
    10  CoreFoundation                      0x24bc1b6d <redacted> + 8
    11  CoreFoundation                      0x24bc0067 <redacted> + 1574
    12  CoreFoundation                      0x24b0f229 CFRunLoopRunSpecific + 520
    13  CoreFoundation                      0x24b0f015 CFRunLoopRunInMode + 108
    14  GraphicsServices                    0x260ffac9 GSEventRunModal + 160
    15  UIKit                               0x291e3189 UIApplicationMain + 144
    16  linphone                            0x0002b949 main + 124
    17  libdyld.dylib                       0x247b7873 <redacted> + 2
)
2016-10-19 14:03:26.907 linphone[332:33741] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString objectForKey:]: unrecognized selector sent to instance 0x18e5c760'
*** First throw call stack:
(0x24bff91b 0x2439ae17 0x24c052b5 0x24c02ee1 0x24b2e238 0x2ee2f 0x30f15 0x12ddb7f 0x12ddb6b 0x12e2655 0x24bc1b6d 0x24bc0067 0x24b0f229 0x24b0f015 0x260ffac9 0x291e3189 0x2b949 0x247b7873)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

这是应用程序崩溃时 XCode 指向我的代码。

- (void)processRemoteNotificationNSDictionary *)userInfo {

    NSDictionary *aps = [userInfo objectForKey"aps"];

    if (aps != nil) {
        NSDictionary *alert = [aps objectForKey"alert"];
        if (alert != nil) {
            NSString *loc_key = [alert objectForKey"loc-key"];
            /* if we receive a remote notification, it is probably because our TCP background socket was no more working.
             As a result, break it and refresh registers in order to make sure to receive incoming INVITE or MESSAGE*/
            if (linphone_core_get_calls(LC) == NULL) { // if there are calls, obviously our TCP socket shall be working
                //linphone_core_set_network_reachable(LC, FALSE);
                if (!linphone_core_is_network_reachable(LC)) {
                    LinphoneManager.instance.connectivity = none; //Force connectivity to be discovered again
                    [LinphoneManager.instance setupNetworkReachabilityCallback];
                }
                if (loc_key != nil) {

                    NSString *callId = [userInfo objectForKey"call-id"];
                    if (callId != nil) {
                        [LinphoneManager.instance addPushCallId:callId];
                    } else {
                        LOGE(@"ushNotification: does not have call-id yet, fix it !");
                    }

                    if ([loc_key isEqualToString"IC_MSG"]) {
                        [self fixRing];
                    }
                }
            }
        }
    }
    LOGI(@"Notification %@ processed", userInfo.description);
}

如您所见,我确实收到了推送通知,但仅在日志中,它不会在我的手机上弹出并且应用程序崩溃。



Best Answer-推荐答案


您正在访问“alert”字典中键“loc-key”的值,而有效负载“alert”字典中没有此键的值,因此它在 NSString *loc_key = 处崩溃[alert objectForKey"loc-key"];

关于ios - 收到 Voip Push 后崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40136653/

回复

使用道具 举报

懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关注0

粉丝2

帖子830918

发布主题
阅读排行 更多
广告位

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap