'CXCallDirectoryProvider in Callkit is not called
I'm trying to build a caller id for iOS application based on the example of Hotline. I have done the following steps:
- Install the hotline app.
- Enable the Call blocking and identification in settings.
- Register the
ProviderDelegateandCallManagerinAppDelegate
My CallDirectoryHandler as follows:
class CallDirectoryHandler: CXCallDirectoryProvider {
override func beginRequest(with context: CXCallDirectoryExtensionContext) {
print("CallDirectoryHandler beginRequest is called")
context.delegate = self
// Check whether this is an "incremental" data request. If so, only provide the set of phone number blocking
// and identification entries which have been added or removed since the last time this extension's data was loaded.
// But the extension must still be prepared to provide the full set of data at any time, so add all blocking
// and identification phone numbers if the request is not incremental.
if context.isIncremental {
addOrRemoveIncrementalBlockingPhoneNumbers(to: context)
addOrRemoveIncrementalIdentificationPhoneNumbers(to: context)
} else {
addAllBlockingPhoneNumbers(to: context)
addAllIdentificationPhoneNumbers(to: context)
}
context.completeRequest()
}
}
I use another phone to call my iPhone. However, the app does not print anything. What steps did I miss ?
Thanks
Solution 1:[1]
Well, it's magic. I was using the PyCharm 2021.2.3 (Community Edition), Python 3.10 interpreter and PyQt5 5.15.6 when I got the exception I mentioned in my original post.
I changed the interpreter to Python 3.8 with PyQt5 5.15.4 and voila it worked like I expected it should.
So, I changed the interpreter back to the Python 3.10 that I was originally using and voila it worked like I expected it should.
Thence, I ran it from the command line (Python 3.8 PyQt5 5.15.2 from an Anaconda3 distribution; this was the interpreter that I "did not" refer to in my original question and bummer it failed again.
So, I replace pyqt5 5.15.2 with 5.15.6 (using pip) in the Anaconda3 distribution's file and voila it worked like I expected it should. (pip may have been a no-no; I suppose I will learn in time.)
I do not intend to reinstall the Pyqt5 5.15.2 in the Anaconda3 unless someone is really interested in was it the version or was something corrupted.
Solution 2:[2]
Probably you didn't import correctly the package so it couldn't be found.
Did you import it in the beggining of the code:
from PyQt5.QtWidgets import QMainWindow, QApplication, QPushButton, QWidget, QAction, QTabWidget, QVBoxLayout, QLabel
Reference: https://www.geeksforgeeks.org/pyqt5-qtabwidget/
Here is the documentation: https://doc.qt.io/qt-5/qtabwidget.html
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | sherril blackmon |
| Solution 2 | pedro_bb7 |
