Sudesh Kumar
Sudesh Kumar

Reputation: 569

Voip push notification crashed on iPhone 7 with iOS 10.3

I'm working on voip notification implementation. My build is working fine on device iPhone 6 with iOS 11.3. But it crashed on iPhone 7 with iOS 10.3.3 version with following error:

pushregistry:didreceiveincomingpushwithpayload:fortype:]: unrecognized selector sent to instance

Please help me if any body faces such problem.

Upvotes: 2

Views: 960

Answers (2)

ak_ninan
ak_ninan

Reputation: 781

The delegate method is deprecated from iOS11. So please do the below delegates according to your OS version

@available(iOS, introduced: 8.0, deprecated: 11.0)
public func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, forType type: PKPushType) {
//do the necessary operations
}

@available(iOS 11.0, *)
public func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType, completion: @escaping () -> Swift.Void) {
//do the necessary operations
}

Upvotes: 2

aBilal17
aBilal17

Reputation: 3132

You have implemented delegate method with completion handler like below.

- (void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayload:(PKPushPayload *)payload 
         forType:(PKPushType)type withCompletionHandler:(void (^)(void))completion;

Please implement same delegate method without completion handler as well like below.

- (void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayload:(PKPushPayload *)payload 
         forType:(PKPushType)type;

Do let me know if you required more help.

Upvotes: 0

Related Questions