2017-08-10 100 views
0

如何在呼叫處於Ringing狀態時斷開CallKit中的呼叫?我正在使用下面的代碼斷開callKit Call。Ringing State Callkit斷開呼叫iOS

此代碼工作時,我接受後斷開呼叫。但是當一個呼叫處於Ringing狀態時,這個代碼不起作用。呼叫保持振鈴。

我檢查過UUID不是零。

請讓我知道什麼是做這個

@property (nonatomic, strong) CXCallController *callKitCallController; 

- (void)performEndCallActionWithUUID:(NSUUID *)uuid { 
    if (uuid == nil) { 
     return; 
    } 
    CXEndCallAction *endCallAction = [[CXEndCallAction alloc] initWithCallUUID:uuid]; 
    CXTransaction *transaction = [[CXTransaction alloc] initWithAction:endCallAction]; 
    [self.callKitCallController requestTransaction:transaction completion:^(NSError *error) { 
     if (error) { 
      NSLog(@"EndCallAction transaction request failed: %@", [error localizedDescription]); 
     } 
     else { 
      NSLog(@"EndCallAction transaction request successful"); 
     } 
    }]; 
} 

的正確方法我都試過這個鏈接也 - >。 Callkit Call End

我得到這個error..please檢查截圖 enter image description here

回答

0

添加這個方法在你的類,

+ (CXTransaction *)transactionWithActions:(NSArray <CXAction *> *)actions { 

CXTransaction *transcation = [[CXTransaction alloc] init];

for (CXAction *action in actions) { 

[transcation addAction:action]; 

} 
return transcation; 
}