react-native-callkeep icon indicating copy to clipboard operation
react-native-callkeep copied to clipboard

Can't build app after updating to 3.0.2 - Use of undeclared identifier

Open ahmadworks opened this issue 7 years ago • 10 comments

Just updated to 3.0.2, updated AppDelegate.m according the the updated readme

but I got these errors after adding this function.

No known class method for selector 'didReceiveIncomingPushWithPayload:forType:' Use of undeclared identifier 'callerName' Use of undeclared identifier 'handle' Use of undeclared identifier 'uuid'

- (void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(PKPushType)type withCompletionHandler:(void (^)(void))completion {
  // Process the received push
  [RNVoipPushNotificationManager didReceiveIncomingPushWithPayload:payload forType:(NSString *)type];
  
  // Retrieve information like handle and callerName here
  
  [RNCallKeep reportNewIncomingCall:uuid handle:handle handleType:@"generic" hasVideo:false localizedCallerName:callerName fromPushKit: YES];

  completion();
}

ahmadworks avatar Sep 25 '19 12:09 ahmadworks

Hi @ahmadworks ! As the comment says, it's up to you to fetch these variables from your push payload:

NSString *uuid = [[[NSUUID UUID] UUIDString] lowercaseString];
NSString *callerName = @"caller name here";
NSString *handle = @"caller number here";

I'lll update the README so it'll be more comprehensive.

manuquentin avatar Sep 25 '19 12:09 manuquentin

Thanks for making this clear, I still can't build the app. Got this error:

Collection element of type 'BOOL' (aka 'bool') is not an Objective-C object in RNCallKeep.m near line 345

ahmadworks avatar Sep 25 '19 12:09 ahmadworks

Ok I see the issue, can you check with the 3.0.3 version please ?

manuquentin avatar Sep 25 '19 13:09 manuquentin

It's working now, but can you please explain why should I add this function to AppDelegate.m [RNCallKeep reportNewIncomingCall:uuid handle:handle handleType:@"generic" hasVideo:false localizedCallerName:callerName fromPushKit: YES];

and what behavior will change in CallKit if I don't add it?

ahmadworks avatar Sep 25 '19 13:09 ahmadworks

Like the documentation says : Since iOS 13, you'll have to report the incoming calls that wakes up your application, like in your AppDelegate.m

If you make VoIP push on ios to wake up your application when killed or in background since a long time (~5/15mn), you should call this method to inform Apple that you're making a VoIP push to make a call.

If you don't Apple will stop sending VoIP push to your application.

manuquentin avatar Sep 25 '19 13:09 manuquentin

Ok, thanks. But is mandatory to include caller name while reporting incoming calls. since I can't figure out how to get the caller display name from the notification payload, I can get it in react native and class but can't get it in AppDelegate.m. Can I just use a fixed name like MyAppName to report call to apple?

ahmadworks avatar Sep 25 '19 13:09 ahmadworks

If your server send the push when your user receive a call, it can send in the push payload who is calling.

But if you can't know server-side, I think you can make the caller number as the caller name and update it after with updateDisplay in your react-native code base.

manuquentin avatar Sep 25 '19 13:09 manuquentin

Hi @ahmadworks, can I close this issue ?

manuquentin avatar Sep 30 '19 12:09 manuquentin

Closing

danjenkins avatar Nov 11 '19 16:11 danjenkins

I'm also getting this error with the versions 3.0.11 and 3.0.12. With version 3.0.10 the error goes away.

image

djalmajr avatar Mar 31 '20 20:03 djalmajr