2017-10-15 10 views
0

に問題があるが、スクリーンショットError Image私はここにこれを解決する方法を教えてください私は私のプロジェクトに追加した拡張機能を有効にしていたとき、私はエラーを取得していますコールディレクトリハンドラの拡張スウィフト3 CallKit

です他の詳細が必要です私にそれらを提供することを私に尋ねてください。

private func addAllBlockingPhoneNumbers(to context: CXCallDirectoryExtensionContext) { 

    for i in 0...numbers.count - 1 
    { 


    let allPhoneNumbers: [CXCallDirectoryPhoneNumber] = [ numbers[i] ] 
    for phoneNumber in allPhoneNumbers { 
     context.addBlockingEntry(withNextSequentialPhoneNumber: phoneNumber) 
    } 
    } 
} 

----------------------------

override func beginRequest(with context: CXCallDirectoryExtensionContext) { 
     context.delegate = self 


     numbers = DBManager.shared.selectContacts() 
    } 
+0

ソースコードを参照することをお勧めします –

+0

いくつかのコードを追加してください@GabrielLidenor –

答えて

0

私はチェックをお勧めしたいですエラーコードはCXCallDirectoryExtensionContextDelegateです。今

func requestFailed(for extensionContext: CXCallDirectoryExtensionContext, withError error: Error) {   
    let errorCode = (error as NSError).code 
    switch errorCode { 
    case CXErrorCodeCallDirectoryManagerError.Code.unknown.rawValue: 
     print("Extension could not be load for an unknown reason.") 
    case CXErrorCodeCallDirectoryManagerError.Code.noExtensionFound.rawValue: 
     print("Could not load extension. Extension not found") 
    case CXErrorCodeCallDirectoryManagerError.Code.loadingInterrupted.rawValue: 
     print("Could not load extension. Extension was interrupted while loading") 
    case CXErrorCodeCallDirectoryManagerError.Code.entriesOutOfOrder.rawValue: 
     print("Could not load extension. Call entries are out of order") 
    case CXErrorCodeCallDirectoryManagerError.Code.duplicateEntries.rawValue: 
     print("Could not load extension. Duplicate entries") 
    case CXErrorCodeCallDirectoryManagerError.Code.maximumEntriesExceeded.rawValue: 
     print("Could not load extension. Maximum entries exceeded") 
    case CXErrorCodeCallDirectoryManagerError.Code.extensionDisabled.rawValue: 
     print("Extension not enabled in Settings") 
    case CXErrorCodeCallDirectoryManagerError.Code.unexpectedIncrementalRemoval.rawValue: 
     print("Unexpected incremental removal") 
    case CXErrorCodeCallDirectoryManagerError.Code.currentlyLoading.rawValue: 
     print("Could not load extension. The extension is currently loading") 
    default: 
     print("Could not load extension.") 
    } 
} 

、Xcodeで拡張機能をデバッグ:requestFailed機能にこのコードを入れてください。 (See details here。)設定で拡張機能を有効にしようとすると、Xcodeは何がうまくいかなかったのかを示すエラーメッセージを出力するはずです。

1

私は同じ問題を抱えていて、エラーを取り除いて、拡張ディレクトリのデータモデルをターゲットディレクトリのビルドフェーズに追加したときにCall Directory Extensionを正常にリンクすることができました。

プロジェクトを選択して、ターゲット拡張を選択し、ビルド段階を選択してソースをコンパイルするには+を選択します。

希望すると便利です。

関連する問題