morenoh149 / react-native-contacts

React Native Contacts
MIT License
1.65k stars 564 forks source link

iOS getById do not return thumbnailPath while getAll does #719

Closed dprevost-LMI closed 7 months ago

dprevost-LMI commented 1 year ago

As shown below, the getAll returns all the contacts with the thumbnailPath while the getById does not. And this is only for iOS.

image

I tried to change the getContactById method in /RCTContacts.m and use withThumbnails:true (See here and here, but it returned an error.

I did not dig deeper into iOS to understand why, but is this something that could be fixed?

Meanwhile, as a workaround, when doing getById on iOS, I use getPhotoForId when hasThumbnail is true.

dprevost-LMI commented 1 year ago

FYI: When trying to pass use withThumbnails:true in getContactById, I had the below error.

Exception 'A property was not requested when contact was fetched.' was thrown while invoking getContactById on target Contacts with params (
    "105ECC31-5E65-495E-AAB4-61CFAC933A26:ABPerson",
    57060,
    57061
)
callstack: (
    0   CoreFoundation                      0x0000000196604cc0 A900B459-0127-379E-9CBA-0EAB9C5D559F + 40128
    1   libobjc.A.dylib                     0x000000018f6a43d0 objc_exception_throw + 60
    2   CoreFoundation                      0x00000001966f2224 A900B459-0127-379E-9CBA-0EAB9C5D559F + 1012260
    3   Contacts                            0x00000001a21ce19c DC04FB9D-0749-3FDA-BA32-43A8ED44FA3A + 119196
    4   app                         0x0000000105ecbbf4 -[RCTContacts getFilePathForThumbnailImage:recordID:] + 120
    5   app                         0x0000000105ecb940 -[RCTContacts contactToDictionary:withThumbnails:] + 5392
    6   app                         0x0000000105ecc8ec -[RCTContacts getContact:addressBook:withThumbnails:] + 592
    7   app                         0x0000000105ecc574 -[RCTContacts getContactById:resolver:rejecter:] + 480
    8   CoreFoundation                      0x000000019666dc04 A900B459-0127-379E-9CBA-0EAB9C5D559F + 470020
    9   CoreFoundation                      0x000000019661bcb4 A900B459-0127-379E-9CBA-0EAB9C5D559F + 134324
    10  CoreFoundation                      0x000000019661b6cc A900B459-0127-379E-9CBA-0EAB9C5D559F + 132812
    11  app                         0x000000010594b620 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 1744
    12  app                         0x000000010594f464 _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicEiN12_GLOBAL__N_117SchedulingContextE + 1544
    13  app                         0x000000010594ec80 _ZZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEiENK3$_0clEv + 144
    14  app                         0x000000010594ebe4 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 28
    15  libdispatch.dylib                   0x000000019daca320 5D16936B-4E4C-3276-BA7A-69C9BC760ABA + 8992
    16  libdispatch.dylib                   0x000000019dacbeac 5D16936B-4E4C-3276-BA7A-69C9BC760ABA + 16044
    17  libdispatch.dylib                   0x000000019dad3534 5D16936B-4E4C-3276-BA7A-69C9BC760ABA + 46388
    18  libdispatch.dylib                   0x000000019dad40a4 5D16936B-4E4C-3276-BA7A-69C9BC760ABA + 49316
    19  libdispatch.dylib                   0x000000019dadecdc 5D16936B-4E4C-3276-BA7A-69C9BC760ABA + 93404
    20  libsystem_pthread.dylib             0x00000001f6439ddc _pthread_wqthread + 288
    21  libsystem_pthread.dylib             0x00000001f6439b7c start_wqthread + 8
)

RCTFatal
facebook::react::invokeInner(RCTBridge*, RCTModuleData*, unsigned int, folly::dynamic const&, int, (anonymous namespace)::SchedulingContext)
facebook::react::RCTNativeModule::invoke(unsigned int, folly::dynamic&&, int)::$_0::operator()() const
invocation function for block in facebook::react::RCTNativeModule::invoke(unsigned int, folly::dynamic&&, int)
5D16936B-4E4C-3276-BA7A-69C9BC760ABA
5D16936B-4E4C-3276-BA7A-69C9BC760ABA
5D16936B-4E4C-3276-BA7A-69C9BC760ABA
5D16936B-4E4C-3276-BA7A-69C9BC760ABA
5D16936B-4E4C-3276-BA7A-69C9BC760ABA
_pthread_wqthread
start_wqthread`
morenoh149 commented 1 year ago

not sure. Does it work on android?

dprevost-LMI commented 1 year ago

It does; I did not have to apply the same fix on Android. Do you need more data?

morenoh149 commented 1 year ago

That is a hint, the issue is only on ios.

github-actions[bot] commented 11 months ago

This issue is stale, please provide more information about the status

dprevost-LMI commented 11 months ago

Status: Android provides the thumbnailPath, while iOS does not for the getByID. iOS should be fixed to have the same behaviour

dprevost-LMI commented 10 months ago

What must I do to keep this open since there was activity and it is a valid bug?

morenoh149 commented 9 months ago

@dprevost-LMI comment

dprevost-LMI commented 8 months ago

🤔

dprevost-LMI commented 7 months ago

Is there any reason to close those automatically while they are real issues?

morenoh149 commented 6 months ago

I don't think it makes sense to keep them open unless someone is working on them.