2016-10-04 4 views
2

CallPad를 내 Voip 응용 프로그램에 통합하려고합니다. Apple WWDC의 SpeakerBox 샘플 코드를 참조했습니다. ProviderDelegate 클래스를 만들고 reportNewIncomingCall 메서드를 호출 한 후 들어오는 호출 UI를 볼 수 있습니다.CXProviderDelegate 메서드가 트리거되지 않았습니다.

하지만 "응답"/ "종료"버튼을 누르면 해당 제공자 대리인이 해고되지 않습니다. 여기서 무엇이 잘못 될 수 있습니까?

CallProviderDelegate을 인스턴스화하면 "providerDidBegin"이 호출됩니다.

발신자 클래스에서
@implementation CallProviderDelegate 

- (instancetype)init 
{ 
    self = [super init]; 
    if (self) { 
     _providerConfiguration = [self getProviderConfiguration]; 
     _provider = [[CXProvider alloc] initWithConfiguration:_providerConfiguration]; 
     [_provider setDelegate:self queue:nil]; 
    } 
    return self; 
} 

- (void)providerDidBegin:(CXProvider *)provider { 
    // this is getting called 
} 

- (void)provider:(CXProvider *)provider performAnswerCallAction:(CXAnswerCallAction *)action { 
    // this is not getting called when the Answer button is pressed 
} 

- (void)reportNewIncomingCallWithUUID:(nonnull NSUUID *)UUID handle:(nonnull NSString *)handle 
          completion:(nullable void (^)(NSError *_Nullable error))completion { 

    CXCallUpdate *update = [[CXCallUpdate alloc] init]; 
    update.remoteHandle = [[CXHandle alloc] initWithType:CXHandleTypePhoneNumber value:handle]; 
    update.hasVideo = NO; 

    [_provider reportNewIncomingCallWithUUID:UUID update:update completion:^(NSError * _Nullable error) { 
     completion(error); 
    }]; 
} 

: 당신의 "발신자"클래스에서

CallProviderDelegate *providerDelegate = [[CallProviderDelegate alloc] init]; 
[providerDelegate reportNewIncomingCallWithUUID:[NSUUID UUID] handle:@"Raj" completion:^(NSError * _Nullable error) { 
      // 
}]; 

답변

2

, 당신은 CallProviderDelegate 클래스를 인스턴스화하고 providerDelegate 변수에 할당하는 코드가, 당신은 providerDelegate 객체 참조를 저장하는 즉 인스턴스 변수 또는 속성에서? 임시 로컬 변수에만 할당되는 경우 호출 메서드가 실행 완료 후 CallProviderDelegate 개체가 할당 해제되고 CallProviderDelegate 개체가 할당 해제되면 더 이상 CXProvider 대리자 메시지가 배달되지 않습니다.

CallProviderDelegate 개체가 우연히 할당 해제되지 않았는지 확인하고 싶습니다.

+0

예, 저는이 정확한 실수를하고 나중에 수정했습니다. 스레드 업데이트를 잊어 버렸습니다. 스튜어트에게 대답 할 시간을내어 주셔서 감사합니다. – Rajavelu

+0

@Rajavelu : APp의 CallKit UI를 어떻게 가져올 수 있는지 알려주세요. –

+0

@SaurabhPrajapati 공급자 위임자로부터 'reportNewIncomingCall'메서드를 호출해야합니다. – Rajavelu

관련 문제