这不是给我代码问题,这是一个可行性问题。如果我使用CallKit发起电话,是否也可以以编程方式结束它?
答案 0 :(得分:9)
是的,我们可以通过编程方式执行,但我们必须保留该调用的UUID,
CXEndCallAction *endaction = [[CXEndCallAction alloc] initWithCallUUID:callUUID];
[cxcallcontrollerobject requestTransaction:[CXTransaction transactionWithActions:@[action]] completion:completion];
+ (CXTransaction *)transactionWithActions:(NSArray <CXAction *> *)actions {
CXTransaction *transcation = [[CXTransaction alloc] init];
for (CXAction *action in actions) {
[transcation addAction:action];
}
return transcation;
}
希望这会有所帮助。
答案 1 :(得分:2)
快速使用以下代码,uuidCallKit是我当前通话的UUID。
// server.js
const next = require('next')
const routes = require('./routes') // <- your routes file
const app = next({dev: process.env.NODE_ENV !== 'production'})
const handler = routes.getRequestHandler(app)
// With express
const express = require('express')
app.prepare().then(() => {
express()
.use(handler) // <- this line is important
.listen(3000)
})
答案 2 :(得分:0)
关闭所有通话(Swift4)
func endCall(call: UUID) {
let endCallAction = CXEndCallAction(call: call)
let transaction = CXTransaction(action: endCallAction)
cxCallController.request(transaction) { error in
if let error = error {
print("EndCallAction transaction request failed: \(error.localizedDescription).")
self.cxCallProvider.reportCall(with: call, endedAt: Date(), reason: .remoteEnded)
return
}
print("EndCallAction transaction request successful")
}
}