2016-11-07 6 views
2
메신저 블록 부분은 내가 식별 할 번호를 추가 할 때 유일한 문제는, 완벽하게 작동, 차단하고 번호를 식별 할 callDirectory 확장을 사용, 내 아이폰 OS 프로젝트에 callKit을 구현

메신저 :오류 CallKit에서 CallDirectory 확장

private func retrievePhoneNumbersToIdentifyAndLabels() -> (phoneNumbers: [String], labels: [String])? { 
    // retrieve list of phone numbers to identify, and their labels 
    interDefaults?.synchronize() 
    if let numbers = interDefaults!.string(forKey: "ident-numbers"){ 
     if let identities = interDefaults!.string(forKey: "ident-identities"){ 
      let formattedNumbers = numbers.characters.split{$0 == "*"}.map(String.init) 
      let formattedIdent = identities.characters.split{$0 == "*"}.map(String.init) 
      return (formattedNumbers, formattedIdent) 
     } 
    } 
    return ([""], [""]) 

} 

내가 그것을 오류와 함께 실패 확장 relaod 할 때 : 내가 한 요소 EXP의 배열로 formattedIdent를 대체하여 있음을 알아 낸 몇 가지 테스트를 Error Domain=com.apple.CallKit.error.calldirectorymanager Code=3 "(null)"

: ["Spamm Caller"]을 확장 완벽하게 작동 및 오류를 보여줍니다하지만 둘 이상의 요소가있는 배열을 사용할 때 샘 e 오류가 나타납니다. 나는 무엇인가 잘못하고 있니? 미리

+0

iOS에서 알림 일시 중지 기능을 사용하는 동안 앱을 개발할 때이 오류가 발생했습니다. – matusalem

+0

@matusalem Callkit을 사용하여 iOS 앱에서 방해 금지를 활성화하는 방법 ...? – Pramod

+0

@pramod Callkit SDK에 포함되어 있지 않습니다. – matusalem

답변

1

CallDirectory로부터의 에러 코드의 덕분 포함 헤더 <CallKit/CXError.h>에 정의되어 제공되는 전화 번호 (들)이 고장난 경우

CXErrorCodeCallDirectoryManagerErrorEntriesOutOfOrder = 3, 

이 특정 에러가 리턴된다. 숫자는 숫자로 오름차순으로 제공되어야합니다.

+0

에 포함되지 않았다고 생각합니다. 제가 제공 한 번호가 순서대로되어 있습니다. –

+0

확인해주세요. http://stackoverflow.com/questions/40837561/how-to-use-call-directory-extension-to-identify-a-incoming-call/40838374#40838374 –

+1

한순간에 저는 숫자를 문자열로 정렬하고 문자열을 정렬합니다. 그러나 그 숫자는 길이가 다를 수 있기 때문에 효과가 없습니다. 일단 NSNumbers (정렬 용)로 작업을 시작하면 모든 것이 잘되었습니다. 또한 중복 된 번호를 제거하십시오. –

0

내 번호가 올바르게 주문 되었음에도 불구하고 오류 3이 발생했습니다. 내가 해결 한 것은 CallDirectoryHandler 파일에있는 private 함수의 예제 코드를 주석 처리하는 것이 었습니다.

현재 발신자 ID 만 사용하고 있지만 차단 기능을 사용하고 있다면 해당 샘플 코드도 제거합니다.

screen grab - commented out code in red

0

그래서 나는 CXErrors에서 팠이 열거 형을 발견 나는 비슷한 문제를했지만, 내가했던 실수는 오류 코드 4로했다.

public enum Code : Int { 


     public typealias _ErrorType = CXErrorCodeCallDirectoryManagerError 

     case unknown 

     case noExtensionFound 

     case loadingInterrupted 

     case entriesOutOfOrder 

     case duplicateEntries 

     case maximumEntriesExceeded 

     case extensionDisabled 

     @available(iOS 10.3, *) 
     case currentlyLoading 

     @available(iOS 11.0, *) 
     case unexpectedIncrementalRemoval 
    } 

기본적으로 unknown == Code 0이고 다른 옵션은 1 씩 증가합니다. 확장 프로그램이이 날짜까지 새 데이터를 처리하려고 할 때받을 수있는 전체 오류 목록입니다.