projection with image crashes the App on iOS
RRGT19 opened this issue · comments
Describe the bug
Using the plugin v4.0.1 (latest), the app crashes on iOS if I use a projection with image
.
To Reproduce
Steps to reproduce the behavior:
const {contacts} = await Contacts.getContacts({
projection: {
name: true,
phones: true,
image: true // <=====
}
});
console.log(contacts);
Expected behavior
No crashes.
Smartphone (please complete the following information):
- Device: iPhone 14 Emulator
- OS: 16.2
Xcode logs
I don't know if these logs can give you more insight of the issue.
"exception" : {"codes":"0x0000000000000000, 0x0000000000000000","rawCodes":[0,0],"type":"EXC_CRASH","signal":"SIGABRT"},
"asiBacktraces" : ["0 CoreFoundation 0x000000018040e7c8 __exceptionPreprocess + 172\n1 libobjc.A.dylib 0x0000000180051144 objc_exception_throw + 56\n2 CoreFoundation 0x000000018040e6d8 -[NSException initWithCoder:] + 0\n3 Contacts 0x000000018871ffe4 -[CNContact thumbnailImageData] + 144\n4 CapacitorCommunityContacts 0x00000001027d6780 $s26CapacitorCommunityContacts14ContactPayloadC8fillDatayySo9CNContactCF + 5692\n5 CapacitorCommunityContacts 0x00000001027d9eb8 $s26CapacitorCommunityContacts0C0C03getC0ySayAA14ContactPayloadCGAA03GetC15ProjectionInputCFySo9CNContactC_Spy10ObjectiveC8ObjCBoolVGtXEfU_ + 140\n6 CapacitorCommunityContacts 0x00000001027d9f48 $sSo9CNContactCSpy10ObjectiveC8ObjCBoolVGIggy_AbFIeggy_TR + 20\n7 CapacitorCommunityContacts 0x00000001027d9fc8 $sSo9CNContactCSpy10ObjectiveC8ObjCBoolVGIeggy_AbFIyByy_TR + 64\n8 Contacts 0x00000001886cd2cc __74-[CNContactStore pool_enumerateContactsWithFetchRequest:error:usingBlock:]_block_invoke_2 + 120\n9 Contacts 0x00000001886cd1e0 __74-[CNContactStore pool_enumerateContactsWithFetchRequest:error:usingBlock:]_block_invoke + 212\n10 Contacts 0x00000001886f8878 __91-[CNDataMapperContactStore enumerateContactsAndMatchInfoWithFetchRequest:error:usingBlock:]_block_invoke_6 + 152\n11 CoreFoundation 0x0000000180376d94 __NSARRAY_IS_CALLING_OUT_TO_A_BLOCK__ + 16\n12 CoreFoundation 0x000000018042f4a8 -[__NSArrayI enumerateObjectsWithOptions:usingBlock:] + 152\n13 Contacts 0x00000001886f87c4 __91-[CNDataMapperContactStore enumerateContactsAndMatchInfoWithFetchRequest:error:usingBlock:]_block_invoke_5 + 140\n14 ContactsFoundation 0x0000000188a849ac __43-[CNObservable enumerateObjectsUsingBlock:]_block_invoke + 92\n15 ContactsFoundation 0x0000000188ab61b4 -[_CNBlockObserver observerDidReceiveResult:] + 168\n16 ContactsFoundation 0x0000000188ab61b4 -[_CNBlockObserver observerDidReceiveResult:] + 168\n17 ContactsFoundation 0x0000000188ab61b4 -[_CNBlockObserver observerDidReceiveResult:] + 168\n18 ContactsFoundation 0x0000000188ab61b4 -[_CNBlockObserver observerDidReceiveResult:] + 168\n19 ContactsFoundation 0x0000000188ab61b4 -[_CNBlockObserver observerDidReceiveResult:] + 168\n20 Contacts 0x000000018869ea90 __52-[CNXPCDataMapper contactObservableForFetchRequest:]_block_invoke_2 + 116\n21 Contacts 0x000000018869f02c __100-[CNXPCDataMapper fetchAndDecodeEncodedContactsForFetchRequest:error:cancelationToken:batchHandler:]_block_invoke_2 + 76\n22 Contacts 0x000000018867f3d0 __85-[CNiOSABContactBuffersDecoder decodeContactsFromData:moreComing:replyHandler:error:]_block_invoke + 176\n23 Contacts 0x00000001886bd944 -[CNContactBufferDecoder decodeContactsFromBuffer:replyHandler:] + 304\n24 Contacts 0x000000018867f2b8 -[CNiOSABContactBuffersDecoder decodeContactsFromData:moreComing:replyHandler:error:] + 200\n25 Contacts 0x000000018869ef94 __100-[CNXPCDataMapper fetchAndDecodeEncodedContactsForFetchRequest:error:cancelationToken:batchHandler:]_block_invoke + 184\n26 Contacts 0x000000018869f4a0 __91-[CNXPCDataMapper fetchEncodedContactsForFetchRequest:error:cancelationToken:batchHandler:]_block_invoke + 256\n27 CoreFoundation 0x0000000180414d00 __invoking___ + 144\n28 CoreFoundation 0x0000000180411ee8 -[NSInvocation invoke] + 276\n29 Foundation 0x0000000180cae608 __NSXPCCONNECTION_IS_CALLING_OUT_TO_REPLY_BLOCK__ + 12\n30 Foundation 0x0000000180cae240 -[NSXPCConnection _decodeAndInvokeReplyBlockWithEvent:sequence:replyInfo:] + 484\n31 Foundation 0x0000000180cb22b0 __88-[NSXPCConnection _sendInvocation:orArguments:count:methodSignature:selector:withProxy:]_block_invoke_5 + 184\n32 Foundation 0x0000000180cb1dcc -[NSXPCConnection _sendInvocation:orArguments:count:methodSignature:selector:withProxy:] + 2164\n33 Foundation 0x0000000180cb1390 -[NSXPCConnection _sendSelector:withProxy:arg1:arg2:] + 124\n34 Foundation 0x0000000180cc4b20 _NSXPCDistantObjectSimpleMessageSend2 + 64\n35 Contacts 0x000000018869f18c -[CNXPCDataMapper fetchEncodedContactsForFetchRequest:error:cancelationToken:batchHandler:] + 312\n36 Contacts 0x000000018869ec20 -[CNXPCDataMapper fetchAndDecodeEncodedContactsForFetchRequest:error:cancelationToken:batchHandler:] + 244\n37 Contacts 0x000000018869e97c __52-[CNXPCDataMapper contactObservableForFetchRequest:]_block_invoke + 188\n38 ContactsFoundation 0x0000000188a84088 __26-[CNObservable doOnError:]_block_invoke + 232\n39 ContactsFoundation 0x0000000188a83e50 __31-[CNObservable doOnCompletion:]_block_invoke + 232\n40 ContactsFoundation 0x0000000188a83e50 __31-[CNObservable doOnCompletion:]_block_invoke + 232\n41 ContactsFoundation 0x0000000188a84088 __26-[CNObservable doOnError:]_block_invoke + 232\n42 ContactsFoundation 0x0000000188a83bac __27-[CNObservable doOnCancel:]_block_invoke + 192\n43 ContactsFoundation 0x0000000188a84890 -[CNObservable enumerateObjectsUsingBlock:] + 320\n44 Contacts 0x00000001886f8544 __91-[CNDataMapperContactStore enumerateContactsAndMatchInfoWithFetchRequest:error:usingBlock:]_block_invoke.55 + 428\n45 Contacts 0x000000018874dbd0 __38-[_CNContactsLogger fetchingContacts:]_block_invoke_2 + 36\n46 libsystem_trace.dylib 0x0000000180065ba8 os_activity_apply_f + 84\n47 Contacts 0x000000018874db40 -[_CNContactsLogger fetchingContacts:] + 188\n48 Contacts 0x00000001886f81d4 -[CNDataMapperContactStore enumerateContactsAndMatchInfoWithFetchRequest:error:usingBlock:] + 452\n49 Contacts 0x00000001886ccfe8 -[CNContactStore pool_enumerateContactsWithFetchRequest:error:usingBlock:] + 240\n50 Contacts 0x00000001886ccd98 -[CNContactStore enumerateContactsWithFetchRequest:error:usingBlock:] + 464\n51 CapacitorCommunityContacts 0x00000001027d9c84 $s26CapacitorCommunityContacts0C0C03getC0ySayAA14ContactPayloadCGAA03GetC15ProjectionInputCF + 420\n52 CapacitorCommunityContacts 0x00000001027ddf1c $s26CapacitorCommunityContacts0C6PluginC03getC0yySo13CAPPluginCallCF + 420\n53 CapacitorCommunityContacts 0x00000001027de20c $s26CapacitorCommunityContacts0C6PluginC03getC0yySo13CAPPluginCallCFTo + 52\n54 Capacitor 0x000000010299a208 $s9Capacitor0A6BridgeC12handleJSCall4callyAA0D0V_tFyycfU_ + 796\n55 Capacitor 0x000000010298e7c8 $sIeg_IeyB_TR + 48\n56 libdispatch.dylib 0x0000000180133fa4 _dispatch_call_block_and_release + 24\n57 libdispatch.dylib 0x0000000180135768 _dispatch_client_callout + 16\n58 libdispatch.dylib 0x000000018013d7f8 _dispatch_lane_serial_drain + 780\n59 libdispatch.dylib 0x000000018013e43c _dispatch_lane_invoke + 392\n60 libdispatch.dylib 0x000000018014a624 _dispatch_workloop_worker_thread + 772\n61 libsystem_pthread.dylib 0x00000001b059a8fc _pthread_wqthread + 284\n62 libsystem_pthread.dylib 0x00000001b05996c0 start_wqthread + 8"],
"extMods" : {"caller":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"system":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"targeted":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"warnings":0},
"lastExceptionBacktrace" : [{"imageOffset":1185724,"symbol":"__exceptionPreprocess","symbolLocation":160,"imageIndex":1},{"imageOffset":151876,"symbol":"objc_exception_throw","symbolLocation":56,"imageIndex":13},{"imageOffset":1185496,"symbol":"-[NSException initWithCoder:]","symbolLocation":0,"imageIndex":1},{"imageOffset":692196,"symbol":"-[CNContact thumbnailImageData]","symbolLocation":144,"imageIndex":17},{"imageOffset":26496,"sourceLine":155,"sourceFile":"ContactPayload.swift","symbol":"ContactPayload.fillData(_:)","imageIndex":18,"symbolLocation":5692},{"imageOffset":40632,"sourceLine":93,"sourceFile":"Contacts.swift","symbol":"closure #1 in Contacts.getContacts(_:)","imageIndex":18,"symbolLocation":140},{"imageOffset":40776,"sourceFile":"<compiler-generated>","symbol":"thunk for @callee_guaranteed (@guaranteed CNContact, @unowned UnsafeMutablePointer<ObjCBool>) -> ()","symbolLocation":20,"imageIndex":18},{"imageOffset":40904,"sourceFile":"<compiler-generated>","symbol":"thunk for @escaping @callee_guaranteed (@guaranteed CNContact, @unowned UnsafeMutablePointer<ObjCBool>) -> ()","symbolLocation":64,"imageIndex":18},{"imageOffset":352972,"symbol":"__74-[CNContactStore pool_enumerateContactsWithFetchRequest:error:usingBlock:]_block_invoke_2","symbolLocation":120,"imageIndex":17},{"imageOffset":352736,"symbol":"__74-[CNContactStore pool_enumerateContactsWithFetchRequest:error:usingBlock:]_block_invoke","symbolLocation":212,"imageIndex":17},{"imageOffset":530552,"symbol":"__91-[CNDataMapperContactStore enumerateContactsAndMatchInfoWithFetchRequest:error:usingBlock:]_block_invoke_6","symbolLocation":152,"imageIndex":17},{"imageOffset":564628,"symbol":"__NSARRAY_IS_CALLING_OUT_TO_A_BLOCK__","symbolLocation":16,"imageIndex":1},{"imageOffset":1320104,"symbol":"-[__NSArrayI enumerateObjectsWithOptions:usingBlock:]","symbolLocation":152,"imageIndex":1},{"imageOffset":530372,"symbol":"__91-[CNDataMapperContactStore enumerateContactsAndMatchInfoWithFetchRequest:error:usingBlock:]_block_invoke_5","symbolLocation":140,"imageIndex":17},{"imageOffset":162220,"symbol":"__43-[CNObservable enumerateObjectsUsingBlock:]_block_invoke","symbolLocation":92,"imageIndex":19},{"imageOffset":364980,"symbol":"-[_CNBlockObserver observerDidReceiveResult:]","symbolLocation":168,"imageIndex":19},{"imageOffset":364980,"symbol":"-[_CNBlockObserver observerDidReceiveResult:]","symbolLocation":168,"imageIndex":19},{"imageOffset":364980,"symbol":"-[_CNBlockObserver observerDidReceiveResult:]","symbolLocation":168,"imageIndex":19},{"imageOffset":364980,"symbol":"-[_CNBlockObserver observerDidReceiveResult:]","symbolLocation":168,"imageIndex":19},{"imageOffset":364980,"symbol":"-[_CNBlockObserver observerDidReceiveResult:]","symbolLocation":168,"imageIndex":19},{"imageOffset":162448,"symbol":"__52-[CNXPCDataMapper contactObservableForFetchRequest:]_block_invoke_2","symbolLocation":116,"imageIndex":17},{"imageOffset":163884,"symbol":"__100-[CNXPCDataMapper fetchAndDecodeEncodedContactsForFetchRequest:error:cancelationToken:batchHandler:]_block_invoke_2","symbolLocation":76,"imageIndex":17},{"imageOffset":33744,"symbol":"__85-[CNiOSABContactBuffersDecoder decodeContactsFromData:moreComing:replyHandler:error:]_block_invoke","symbolLocation":176,"imageIndex":17},{"imageOffset":289092,"symbol":"-[CNContactBufferDecoder decodeContactsFromBuffer:replyHandler:]","symbolLocation":304,"imageIndex":17},{"imageOffset":33464,"symbol":"-[CNiOSABContactBuffersDecoder decodeContactsFromData:moreComing:replyHandler:error:]","symbolLocation":200,"imageIndex":17},{"imageOffset":163732,"symbol":"__100-[CNXPCDataMapper fetchAndDecodeEncodedContactsForFetchRequest:error:cancelationToken:batchHandler:]_block_invoke","symbolLocation":184,"imageIndex":17},{"imageOffset":165024,"symbol":"__91-[CNXPCDataMapper fetchEncodedContactsForFetchRequest:error:cancelationToken:batchHandler:]_block_invoke","symbolLocation":256,"imageIndex":17},{"imageOffset":1211648,"symbol":"__invoking___","symbolLocation":144,"imageIndex":1},{"imageOffset":1199848,"symbol":"-[NSInvocation invoke]","symbolLocation":276,"imageIndex":1},{"imageOffset":5891592,"symbol":"__NSXPCCONNECTION_IS_CALLING_OUT_TO_REPLY_BLOCK__","symbolLocation":12,"imageIndex":7},{"imageOffset":5890624,"symbol":"-[NSXPCConnection _decodeAndInvokeReplyBlockWithEvent:sequence:replyInfo:]","symbolLocation":484,"imageIndex":7},{"imageOffset":5907120,"symbol":"__88-[NSXPCConnection _sendInvocation:orArguments:count:methodSignature:selector:withProxy:]_block_invoke_5","symbolLocation":184,"imageIndex":7},{"imageOffset":5905868,"symbol":"-[NSXPCConnection _sendInvocation:orArguments:count:methodSignature:selector:withProxy:]","symbolLocation":2164,"imageIndex":7},{"imageOffset":5903248,"symbol":"-[NSXPCConnection _sendSelector:withProxy:arg1:arg2:]","symbolLocation":124,"imageIndex":7},{"imageOffset":5983008,"symbol":"_NSXPCDistantObjectSimpleMessageSend2","symbolLocation":64,"imageIndex":7},{"imageOffset":164236,"symbol":"-[CNXPCDataMapper fetchEncodedContactsForFetchRequest:error:cancelationToken:batchHandler:]","symbolLocation":312,"imageIndex":17},{"imageOffset":162848,"symbol":"-[CNXPCDataMapper fetchAndDecodeEncodedContactsForFetchRequest:error:cancelationToken:batchHandler:]","symbolLocation":244,"imageIndex":17},{"imageOffset":162172,"symbol":"__52-[CNXPCDataMapper contactObservableForFetchRequest:]_block_invoke","symbolLocation":188,"imageIndex":17},{"imageOffset":159880,"symbol":"__26-[CNObservable doOnError:]_block_invoke","symbolLocation":232,"imageIndex":19},{"imageOffset":159312,"symbol":"__31-[CNObservable doOnCompletion:]_block_invoke","symbolLocation":232,"imageIndex":19},{"imageOffset":159312,"symbol":"__31-[CNObservable doOnCompletion:]_block_invoke","symbolLocation":232,"imageIndex":19},{"imageOffset":159880,"symbol":"__26-[CNObservable doOnError:]_block_invoke","symbolLocation":232,"imageIndex":19},{"imageOffset":158636,"symbol":"__27-[CNObservable doOnCancel:]_block_invoke","symbolLocation":192,"imageIndex":19},{"imageOffset":161936,"symbol":"-[CNObservable enumerateObjectsUsingBlock:]","symbolLocation":320,"imageIndex":19},{"imageOffset":529732,"symbol":"__91-[CNDataMapperContactStore enumerateContactsAndMatchInfoWithFetchRequest:error:usingBlock:]_block_invoke.55","symbolLocation":428,"imageIndex":17},{"imageOffset":879568,"symbol":"__38-[_CNContactsLogger fetchingContacts:]_block_invoke_2","symbolLocation":36,"imageIndex":17},{"imageOffset":19368,"symbol":"os_activity_apply_f","symbolLocation":84,"imageIndex":20},{"imageOffset":879424,"symbol":"-[_CNContactsLogger fetchingContacts:]","symbolLocation":188,"imageIndex":17},{"imageOffset":528852,"symbol":"-[CNDataMapperContactStore enumerateContactsAndMatchInfoWithFetchRequest:error:usingBlock:]","symbolLocation":452,"imageIndex":17},{"imageOffset":352232,"symbol":"-[CNContactStore pool_enumerateContactsWithFetchRequest:error:usingBlock:]","symbolLocation":240,"imageIndex":17},{"imageOffset":351640,"symbol":"-[CNContactStore enumerateContactsWithFetchRequest:error:usingBlock:]","symbolLocation":464,"imageIndex":17},{"imageOffset":40068,"sourceLine":90,"sourceFile":"Contacts.swift","symbol":"Contacts.getContacts(_:)","imageIndex":18,"symbolLocation":420},{"imageOffset":57116,"sourceLine":129,"sourceFile":"ContactsPlugin.swift","symbol":"ContactsPlugin.getContacts(_:)","imageIndex":18,"symbolLocation":420},{"imageOffset":57868,"sourceFile":"<compiler-generated>","symbol":"@objc ContactsPlugin.getContacts(_:)","symbolLocation":52,"imageIndex":18},{"imageOffset":90632,"sourceLine":506,"sourceFile":"CapacitorBridge.swift","symbol":"closure #1 in CapacitorBridge.handleJSCall(call:)","imageIndex":21,"symbolLocation":796},{"imageOffset":42952,"sourceFile":"<compiler-generated>","symbol":"thunk for @escaping @callee_guaranteed () -> ()","symbolLocation":48,"imageIndex":21},{"imageOffset":8100,"symbol":"_dispatch_call_block_and_release","symbolLocation":24,"imageIndex":14},{"imageOffset":14184,"symbol":"_dispatch_client_callout","symbolLocation":16,"imageIndex":14},{"imageOffset":47096,"symbol":"_dispatch_lane_serial_drain","symbolLocation":780,"imageIndex":14},{"imageOffset":50236,"symbol":"_dispatch_lane_invoke","symbolLocation":392,"imageIndex":14},{"imageOffset":99876,"symbol":"_dispatch_workloop_worker_thread","symbolLocation":772,"imageIndex":14},{"imageOffset":14588,"symbol":"_pthread_wqthread","symbolLocation":284,"imageIndex":8},{"imageOffset":9920,"symbol":"start_wqthread","symbolLocation":8,"imageIndex":8}],
Additional context
If I remove the image projection, all works as expected.
Fixed and released in v3.0.2
and v4.0.2
. Thanks for reporting!