2

我正在尝试在表格中显示选定联系人的 CNContactViewController,该表格显示在模式窗口中:

        let controller = CNContactViewController.init()
        controller.contact = contact.contact
        guard let selectedCellView = contactsTable.view(atColumn: 0, row: contactsTable.selectedRow, makeIfNecessary: false) else {
            print("ERROR: selected cell is not visible")
            return
        }
        let bounds = selectedCellView.bounds
        presentViewController(controller, asPopoverRelativeTo: bounds, of: selectedCellView, preferredEdge: .maxX, behavior: .transient)

弹出窗口正常,一切正常,除了控制台输出:

2017-11-23 14:45:47.322456+0100 Link-em[9253:1949091] warning: illegal subclass ABRemotePersonView instantiating; client should use only NSRemoteView (
    0   ViewBridge                          0x00007fff68c881c0 -[NSRemoteView _preSuperInit] + 195
    1   ViewBridge                          0x00007fff68c88544 -[NSRemoteView initWithFrame:] + 25
    2   AddressBook                         0x00007fff41e33a4e -[ABRemotePersonView initWithFrame:] + 77
    3   AppKit                              0x00007fff41f341c5 -[NSView init] + 62
    4   ContactsUI                          0x00007fff442fa83b -[CNContactViewController loadView] + 50
    5   AppKit                              0x00007fff41f899d2 -[NSViewController _loadViewIfRequired] + 75
    6   AppKit                              0x00007fff41f8993d -[NSViewController view] + 30
    7   ContactsUI                          0x00007fff442fa8c2 -[CNContactViewController _remotePersonView] + 53
    8   ContactsUI                          0x00007fff442fa9a5 -[CNContactViewController serviceViewControllerProxy] + 32
    9   ContactsUI                          0x00007fff442fa732 -[CNContactViewController apiAdapter] + 73
    10  ContactsUI                          0x00007fff442faad1 -[CNContactViewController setContact:] + 71
    11  Link-em                             0x000000010000702f _T07Link_em15ContactsServiceC5getUISo23CNContactViewControllerCSgSS3for_tF + 239
    12  Link-em                             0x0000000100012f37 _T07Link_em27ContactsTableViewControllerC11doubleClickyypF + 1367
    13  Link-em                             0x0000000100013588 _T07Link_em27ContactsTableViewControllerC11doubleClickyypFTo + 72
    14  AppKit                              0x00007fff426dea7a -[NSApplication(NSResponder) sendAction:to:from:] + 312
    15  AppKit                              0x00007fff42185777 -[NSControl sendAction:to:] + 86
    16  AppKit                              0x00007fff421f9188 -[NSTableView _sendAction:to:row:column:] + 121
    17  AppKit                              0x00007fff421f75c7 -[NSTableView mouseDown:] + 7186
    18  AppKit                              0x00007fff4287da01 -[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:] + 5891
    19  AppKit                              0x00007fff4287a658 -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 2359
    20  AppKit                              0x00007fff42879904 -[NSWindow(NSEventRouting) sendEvent:] + 497
    21  AppKit                              0x00007fff426da937 -[NSApplication(NSEvent) sendEvent:] + 307
    22  AppKit                              0x00007fff4217a0f6 -[NSApplication _doModalLoop:peek:] + 551
    23  AppKit                              0x00007fff4235ed63 __35-[NSApplication runModalForWindow:]_block_invoke_2 + 64
    24  AppKit                              0x00007fff4235ed10 __35-[NSApplication runModalForWindow:]_block_invoke + 75
    25  AppKit                              0x00007fff4280c101 _NSTryRunModal + 100
    26  AppKit                              0x00007fff42177b3d -[NSApplication runModalForWindow:] + 133
    27  Link-em                             0x0000000100010775 
    [...skipped rest...]
)

我能做些什么吗?看起来像 MacOS 中的错误,但可能是我没有正确初始化某些东西?或者可能无法从模态窗口实例化此类控制器?

4

0 回答 0