Why did I get an error in playground in debug window for this code?
print("// MARK: - Start execable code here...")
do {
let store = CNContactStore()
if try await store.requestAccess(for: .contacts) {
// Do something with Contacts.
let phoneNumber = CNPhoneNumber(stringValue: "903-276-1046")
let predicateForContactsMatchingPhoneNumber = CNContact.predicateForContacts(matching: phoneNumber)
let contactFetchRequest = CNContactFetchRequest(keysToFetch: thoroughKeysToCompare)
contactFetchRequest.predicate = predicateForContactsMatchingPhoneNumber
contactFetchRequest.unifyResults = true
var contactOfMe: CNContact! = nil
try! store.enumerateContacts(with: contactFetchRequest) {
contact, stop in
contactOfMe = contact
stop.pointee = true
}
let contact = Contact(cnContact: contactOfMe)
for property in contact.enumerated() {
print("- \(property)")
}
} else {
// Handle if Contacts access is denied.
fatalError()
}
} catch {
// Handle any error.
print("error requesting access: \(error.localizedDescription)")
}
Debug window:
// MARK: - Start execable code here...
Playground execution failed:
error: Execution was interrupted, reason: shared-library-event.
The process has been left at the point where it was interrupted, use "thread return -x" to return to the state before expression evaluation.
* thread #1, queue = 'com.apple.main-thread'
frame #0: 0x00007ff80002f931 libobjc.A.dylib`_mapStrHash(_NXMapTable*, void const*) + 73
frame #1: 0x00007ff80002fc7f libobjc.A.dylib`_NXMapMember(_NXMapTable*, void const*, void**) + 35
frame #2: 0x00007ff80003b7ae libobjc.A.dylib`getProtocol(char const*) + 41
frame #3: 0x00007ff8000428e6 libobjc.A.dylib`class_conformsToProtocol + 337
frame #4: 0x00007ff80004ab4e libobjc.A.dylib`-[NSObject conformsToProtocol:] + 47
frame #5: 0x0000000109c27951 UIKitCore`_UIFocusItemContainerIsScrollableContainer + 74
frame #6: 0x0000000109c28e38 UIKitCore`-[_UIFocusEnvironmentContainerTuple initWithOwningEnvironment:itemContainer:] + 194
frame #7: 0x0000000109c28fed UIKitCore`+[_UIFocusEnvironmentContainerTuple tupleWithOwningEnvironment:itemContainer:] + 70
frame #8: 0x0000000109c4f41e UIKitCore`_UIFocusRegionContainerFromEnvironmentAndContainer + 44
frame #9: 0x0000000109c27ed3 UIKitCore`_UIFocusItemContainerAddChildItemsInContextWithArguments + 1162
frame #10: 0x000000010a99c439 UIKitCore`-[UIView _searchForFocusRegionsInContext:] + 962
frame #11: 0x0000000109c6b37f UIKitCore`-[_UIFocusMapSnapshot addRegionsInContainer:] + 4583
frame #12: 0x0000000109c69740 UIKitCore`-[_UIFocusMapSnapshot _capture] + 456
frame #13: 0x0000000109c67fc5 UIKitCore`-[_UIFocusMapSnapshot _initWithSnapshotter:mapArea:searchArea:] + 628
frame #14: 0x0000000109c6cce2 UIKitCore`-[_UIFocusMapSnapshotter captureSnapshot] + 227
frame #15: 0x0000000109c5f450 UIKitCore`-[_UIFocusMap _inferredDefaultFocusItemInEnvironment:] + 147
frame #16: 0x0000000109c2b1cf UIKitCore`-[_UIFocusEnvironmentPreferenceEnumerationContext _inferPreferencesForEnvironment:] + 157
frame #17: 0x0000000109c2abbc UIKitCore`-[_UIFocusEnvironmentPreferenceEnumerationContext _resolvePreferredFocusEnvironments] + 118
frame #18: 0x0000000109c2ab12 UIKitCore`-[_UIFocusEnvironmentPreferenceEnumerationContext prefersNothingFocused] + 31
frame #19: 0x0000000109c2beeb UIKitCore`_enumeratePreferredFocusEnvironments + 198
frame #20: 0x0000000109c2c061 UIKitCore`_enumeratePreferredFocusEnvironments + 572
frame #21: 0x0000000109c2c061 UIKitCore`_enumeratePreferredFocusEnvironments + 572
frame #22: 0x0000000109c2c061 UIKitCore`_enumeratePreferredFocusEnvironments + 572
frame #23: 0x0000000109c2bd11 UIKitCore`-[_UIFocusEnvironmentPreferenceEnumerator enumeratePreferencesForEnvironment:usingBlock:] + 230
frame #24: 0x0000000109c2c747 UIKitCore`-[_UIDeepestPreferredEnvironmentSearch deepestPreferredFocusableItemForEnvironment:withRequest:] + 817
frame #25: 0x0000000109c95837 UIKitCore`-[UIFocusUpdateContext _updateDestinationItemIfNeeded] + 265
frame #26: 0x0000000109c95627 UIKitCore`-[UIFocusUpdateContext _destinationItemInfo] + 22
frame #27: 0x0000000109c95535 UIKitCore`-[UIFocusUpdateContext nextFocusedItem] + 24
frame #28: 0x0000000109c71ea6 UIKitCore`-[UIFocusSystem updateFocusIfNeeded] + 1347
frame #29: 0x0000000109c7608c UIKitCore`__43-[UIFocusSystem _updateFocusUpdateThrottle]_block_invoke + 34
frame #30: 0x000000010a94b971 UIKitCore`-[_UIAfterCACommitBlock run] + 57
frame #31: 0x000000010a94be71 UIKitCore`-[_UIAfterCACommitQueue flush] + 191
frame #32: 0x000000010a3926eb UIKitCore`_runAfterCACommitDeferredBlocks + 782
frame #33: 0x000000010a380fa2 UIKitCore`_cleanUpAfterCAFlushAndRunDeferredBlocks + 96
frame #34: 0x000000010a3b6be1 UIKitCore`_afterCACommitHandler + 58
frame #35: 0x00007ff8003b1c12 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
frame #36: 0x00007ff8003ac57f CoreFoundation`__CFRunLoopDoObservers + 515
frame #37: 0x00007ff8003acaa2 CoreFoundation`__CFRunLoopRun + 1121
frame #38: 0x00007ff8003ac264 CoreFoundation`CFRunLoopRunSpecific + 560
frame #39: 0x00007ff8003ad234 CoreFoundation`CFRunLoopRun + 40
frame #40: 0x00007ff83755a4e3 libswift_Concurrency.dylib`swift_task_asyncMainDrainQueueImpl() + 35
frame #41: 0x00007ff83755a4b4 libswift_Concurrency.dylib`swift_task_asyncMainDrainQueue + 52
frame #42: 0x00000001015d409f $__lldb_expr32`main at <unknown>:0
frame #43: 0x0000000100e25560 EnumeratedContactsCNContact`linkResources + 256
frame #44: 0x00007ff8003b2986 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
frame #45: 0x00007ff8003b2148 CoreFoundation`__CFRunLoopDoBlocks + 399
frame #46: 0x00007ff8003ace09 CoreFoundation`__CFRunLoopRun + 1992
frame #47: 0x00007ff8003ac264 CoreFoundation`CFRunLoopRunSpecific + 560
frame #48: 0x00007ff809b4024e GraphicsServices`GSEventRunModal + 139
frame #49: 0x000000010a3827bf UIKitCore`-[UIApplication _run] + 994
frame #50: 0x000000010a3875de UIKitCore`UIApplicationMain + 123
* frame #51: 0x0000000100e256c5 EnumeratedContactsCNContact`main + 357
frame #52: 0x0000000100fbb384 dyld_sim`start_sim + 10
frame #53: 0x000000010943341f dyld`start + 1903```