Использование ios pushkit didReceiveIncomingPushWithPayload; Вызовите и передайте несколько параметров, включая withCompletionHandler. Как бы выглядел вызов функции, интерфейс и быстрые аргументы с withCompletionHandler?
AppDelegate.m
- (void)pushRegistry:(PKPushRegistry *)registry
didReceiveIncomingPushWithPayload:(PKPushPayload *)payload
forType:(PKPushType)type
withCompletionHandler:(void (^)(void))completion{
NSLog(@"VHC: AppDelegate - didReceiveIncomingPushWithPayload hit!");
Voip* instance = [Voip new];
[instance handleIncomingPush:payload forType:type withCompletionHandler:completion];
}
Voip.h
-(void)handleIncomingPush: (PKPushPayload *)payload forType:(PKPushType)type withCompletionHandler:(void (^)(void))completion;
Voip.swift
@objc(handleIncomingPush: : :)
func handleIncomingPush(_ payload: PKPushPayload, forType: PKPushType, withCompletionHandler: @escaping () -> Void) {
withCompletionHandler()
}
Ошибка
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Voip handleIncomingPush:forType:withCompletionHandler:]: unrecognized selector sent to instance 0x2806f4f30'