我有自己的PeoplePicker控制器来自ABPeoplePickerNavigationController
的inherts。我正在尝试使用NSPredicate
设置self.predicateForEnablingPerson
preidcateWithBlock
,如下所示:
self.predicateForEnablingPerson = [NSPredicate predicateWithBlock:^BOOL(id evaluatedObject, NSDictionary *bindings) {
return YES;
}];
它崩溃了错误:
**因未捕获的异常终止应用程序' NSInvalidArgumentException',原因:' NSBlockPredicate无法编码或解码'
*** First throw call stack:
(
0 CoreFoundation 0x000000010ea3fc65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010e615bb7 objc_exception_throw + 45
2 CoreFoundation 0x000000010ea3fb9d +[NSException raise:format:] + 205
3 Foundation 0x000000010c7e5974 -[NSXPCEncoder _encodeObject:] + 628
4 Foundation 0x000000010c7f452c -[NSXPCEncoder _encodeArrayOfObjects:forKey:] + 276
5 Foundation 0x000000010c7ce55c -[NSDictionary(NSDictionary) encodeWithCoder:] + 904
6 Foundation 0x000000010c7e5974 -[NSXPCEncoder _encodeObject:] + 628
7 Foundation 0x000000010c7f452c -[NSXPCEncoder _encodeArrayOfObjects:forKey:] + 276
8 Foundation 0x000000010c7ce55c -[NSDictionary(NSDictionary) encodeWithCoder:] + 904
9 Foundation 0x000000010c7e5974 -[NSXPCEncoder _encodeObject:] + 628
10 Foundation 0x000000010c7db726 encodeInvocationArguments + 462
11 Foundation 0x000000010c7e5af1 -[NSXPCEncoder encodeInvocation:] + 337
12 Foundation 0x000000010c7e5974 -[NSXPCEncoder _encodeObject:] + 628
13 Foundation 0x000000010c932143 -[NSXPCConnection _sendInvocation:withProxy:remoteInterface:withErrorHandler:timeout:userInfo:] + 2478
14 Foundation 0x000000010c93176c -[NSXPCConnection _sendInvocation:withProxy:remoteInterface:withErrorHandler:] + 32
15 CoreFoundation 0x000000010e99cf4f ___forwarding___ + 495
16 CoreFoundation 0x000000010e99ccd8 _CF_forwarding_prep_0 + 120
17 AddressBookUI 0x000000010be542cc -[CNContactPickerExtensionHostContext setupWithOptions:readyBlock:] + 284
18 AddressBookUI 0x000000010be53db4 -[CNContactPickerHostViewController setupWithOptions:readyBlock:] + 159
19 AddressBookUI 0x000000010bd94930 -[CNContactPicker _setupViewController] + 1023
20 AddressBookUI 0x000000010bd9450c -[CNContactPicker _setViewController:] + 322
21 AddressBookUI 0x000000010bd94d4e __41-[CNContactPicker _prepareViewController]_block_invoke112 + 64
22 AddressBookUI 0x000000010be53c76 __55+[CNContactPickerHostViewController getViewController:]_block_invoke + 378
23 UIKit 0x000000010d608ed2 __117-[NSExtension(UIViewControllerAdditions) instantiateViewControllerWithInputItems:listenerEndpoint:connectionHandler:]_block_invoke_3 + 160
24 libdispatch.dylib 0x000000010ef24186 _dispatch_call_block_and_release + 12
25 libdispatch.dylib 0x000000010ef43614 _dispatch_client_callout + 8
26 libdispatch.dylib 0x000000010ef2ba1c _dispatch_main_queue_callback_4CF + 1664
27 CoreFoundation 0x000000010e9a71f9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
28 CoreFoundation 0x000000010e968dcb __CFRunLoopRun + 2043
29 CoreFoundation 0x000000010e968366 CFRunLoopRunSpecific + 470
30 GraphicsServices 0x0000000110523a3e GSEventRunModal + 161
31 UIKit 0x000000010d142900 UIApplicationMain + 1282
32 QwerTyuiop 0x000000010a15f894 main + 100
33 libdyld.dylib 0x000000010ef78145 start + 1
34 ??? 0x0000000000000007 0x0 + 7
)
libc++abi.dylib: terminating with uncaught exception of type NSException
在iPhone 5s 8.3模拟器上进行测试。有人有类似的问题吗?