基本上,我有以下两种方法可以推送相同的调用视图控制器_vcCall。pushViewController 在 on_calling 方法下工作正常,但在 on_incoming_call 下不工作。我确信 self.navigationController 不为空,_vcCall 也不为空。我在这两种方法中都打印了 navigationController 和 _vcCall,它们都有相同的地址。我什至尝试在 on_incoming_call 中创建一个新的视图控制器,但它仍然无法正常工作。
我在屏幕上只有一个按钮,当它被点击时它会推送到调用视图控制器。当 on_calling 方法被触发时,它会成功推送到 _vcCall,但是当 on_incoming_call 被触发时,它什么也不做,只是阻止我点击 Call 按钮。似乎在当前视图控制器上推送了一个透明页面。
有人可以帮忙吗?
- (void)viewDidLoad {
_vcCall = [[CallViewController alloc] init];
}
- (void) sipConnection: (SIPConnection *) connection on_calling: (NSDictionary *) userInfo {
NSLog(@"on_calling: navi: %@", self.navigationController);
[self.navigationController pushViewController:_vcCall animated:YES];
}
- (void)sipConnection:(SIPConnection *)connection on_incoming_call:(NSDictionary *)userInfo {
NSLog(@"on_incoming_call: navi: %@", self.navigationController);
[self.navigationController pushViewController:_vcCall animated:YES];
}
这是第一次触发 on_calling 时控制台中的输出
on_calling: navi: <navViewController: 0x77779d0>
on_incoming_call: navi: <navViewController: 0x77779d0>
以下部分是调用委托方法的地方
- (void) processCallMediaState: (NSDictionary *) userInfo {
int state = [[userInfo objectForKey: kState] intValue];
switch(state) {
case PJSIP_INV_STATE_CALLING: { // After INVITE is sent.
[self.delegate sipConnection:self on_calling:userInfo];
break;
}
case PJSIP_INV_STATE_INCOMING: {// After INVITE is received.
[self.delegate sipConnection:self on_incoming_call:userInfo];
break;
}
case PJSIP_INV_STATE_EARLY: {// After response with To tag.
break;
}
case PJSIP_INV_STATE_CONNECTING:{ // After 2xx is sent/received.
break;
}
case PJSIP_INV_STATE_CONFIRMED: { // After ACK is sent/received.
[self.delegate sipConnection:self on_respond:userInfo];
break;
}
case PJSIP_INV_STATE_DISCONNECTED: {
[self.delegate sipConnection:self on_ending:userInfo];
break;
}
}
}