我试图从PushKit框架导入UserNotifications,但我不知道如何调用它,因为我知道pyobjus中唯一的Include函数是AppKit。当我试图从AppKit调用框架时,我没有看到任何从PushKit调用框架的方法。它返回一个错误。下面是我的代码和错误。我将感谢任何帮助
from pyobjus import autoclass
from pyobjus.dylib_manager import load_framework, INCLUDE
load_framework(INCLUDE.AppKit)
UserNotifications = autoclass('UserNotifications')
回溯
Traceback (most recent call last):
File "/Users/temitayoadefemi/PycharmProjects/test7/mainfile.py", line 5, in <module>
UserNotifications = autoclass('UserNotifications')
File "pyobjus/pyobjus.pyx", line 726, in pyobjus.autoclass
File "pyobjus/pyobjus.pyx", line 85, in pyobjus.MetaObjcClass.__new__
File "pyobjus/pyobjus.pyx", line 116, in pyobjus.MetaObjcClass.resolve_class
pyobjus.ObjcException: Unable to find class b'UserNotifications'
AppKit没有名为
UserNotifications
的类。您可以使用UNNotificationSettings
进行正常推送通知,或者使用PKPushRegistry
进行VoIP推送通知参考资料:
https://developer.apple.com/documentation/pushkit?language=objchttps://developer.apple.com/documentation/usernotifications?language=objc
相关问题 更多 >
编程相关推荐