pkhien95 / react-native-caller-id

React Native Caller ID module
MIT License
2 stars 9 forks source link

This module doesn't work on iOS without extensive modification, it should be listed android only until fixed #3

Open iocuydi opened 3 years ago

iocuydi commented 3 years ago

Just leaving this to save anyone from spending tons of time wondering why this doesn't work for iOS.

The code as currently written hasn't ever been run successfully on iOS, there are several problems, here are a few of the key ones:

-Data group is inconsistent between app and extension: https://github.com/hienphung/react-native-caller-id/blob/eda5385dde9f3b837ab956b6ea3d3de4da23b4a6/ios/CallerIDExtension/CallDirectoryHandler.m#L12 -Dict key is inconsistent between rn and ios: https://github.com/hienphung/react-native-caller-id/blob/eda5385dde9f3b837ab956b6ea3d3de4da23b4a6/ios/CallerIDExtension/CallDirectoryHandler.m#L24 -Inconsistent use of the callers list (uses it as a list of numbers in one place, and a list of lists of numbers in another) https://github.com/hienphung/react-native-caller-id/blob/eda5385dde9f3b837ab956b6ea3d3de4da23b4a6/ios/CallerIDExtension/CallDirectoryHandler.m#L61 -Incorrect conversion to unsignedLongLong: https://github.com/hienphung/react-native-caller-id/blob/eda5385dde9f3b837ab956b6ea3d3de4da23b4a6/ios/CallerIDExtension/CallDirectoryHandler.m#L77 -You have to add app capabilities for app groups in order to communicate between the main application and the call directory extension, read more about this here: https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_security_application-groups

There may be a couple I forgot, but I'd recommend reading a native modules tutorial + CallKit calldirectory tutorial and going from scratch, it's a pretty minimal module to create.

Also, not related to this library, but if you get the error "error:Error Domain=com.apple.CallKit.error.calldirectorymanager Code=3" from iOS, official resources say this means you passed the phone numbers unsorted, but there is some undocumented behavior where you will also get this error if any of the numbers are the wrong length for their area code.

I'd highly recommend attaching a debugger to your extension itself (separate process, not the main app) in xcode if you're having trouble getting this to work.

mlafoy commented 2 years ago

Hi @iocuydi , can you please post here the working result? I've tried to fix several times but still have the problem. Please let me know if you already fixed the all issues for the IOS.

Best Regards, Matt

zoobibackups commented 1 year ago

any one has fixed this

iocuydi commented 1 year ago

I don't have bandwidth right now to share the fix, but try attaching debuggers both for the main process and separate process, and stepping through everything line by line. First do the ios calldirectory tutorial and verify that part is correct.

Also first begin with just a single phone number that you know is formatted correctly. A lot of my struggles debugging ended up being improperly formatted numbers, but (at the time at least) the iOS spec did not document most of the error cases or formatting requirements.

Side note, had to rewrite the android one too, so neither platform really works out of the box :/