我正在尝试访问defaultUserNotificationCenter
我的 C++ 应用程序,但似乎无法正常工作。下面的代码导致错误:
[NSUserNotificationCenter defaultUserNotificationCenter]:无法识别的选择器发送到实例 $memory-location-to-notifCenter
在最后一行提出例外。
id notifCenter = (id)objc_getClass("NSUserNotificationCenter");
notifCenter = objc_msgSend(notifCenter, sel_registerName("alloc"));
notifCenter = objc_msgSend(notifCenter, sel_registerName("defaultUserNotificationCenter"));
我在没有alloc
ing的情况下尝试过这个,notifCenter
但是即使在我使用或不使用包含 Bundle Identifier 的 Info.plist 文件之前,这也会导致notifCenter
为零。...defaultUser...
只是为了确保幕后不会发生任何疯狂的事情,defaultUserNotificationCenter
我编写了一个小的 Obj-C 程序来做同样的事情(NSUserNotificationCenter *defNotifCenter = [NSUserNotificationCenter defaultUserNotificationCenter];)
并将其加载到 Hopper 以检查程序集,它显示:
mov rsi, qword [0x100001128] ;@selector(defaultUserNotificationCenter)
mov rdi, qword [objc_cls_ref_NSUserNotificationCenter]
call imp___stubs__objc_msgSend
这表明系统级别没有任何异常情况发生,所以现在我完全不知所措。