phonegap-build / PushPlugin

This repository is deprecated head to phonegap/phonegap-push-plugin
https://github.com/phonegap/phonegap-plugin-push
MIT License
1.31k stars 996 forks source link

iOS registration not firing callbacks #433

Open emc2spider opened 9 years ago

emc2spider commented 9 years ago

I have an Appgyver application (iOS and Android) that needs to receive push notifications. For this I'm using the PushPlugin since it apparently works with both platforms.

However I'm able to register and receive messages to my Android app, but on iOS I cannot even get the device token from the register function, as the callback is never executed, neither success nor error.

The iOS version my device is running is 8.1.2 and I'm using development certificates.

Please get back to me if you know of any fork to this plugin that has recently worked for Appgyver or have any idea what might be causing this behaviour.

ghost commented 9 years ago

Hi,

I too am experiencing the same issue. I can register and send token info. I can receive notifications when not in my app, but the callback is not being called at all. In Xcode console I can see the notification being received, but the callback is not being executed.

rmorandi commented 9 years ago

try changing the APNS pushing code from:

 $message->setCustomProperty('foo', array("bar", "baz"));

to

 $message->setCustomProperty('foo', "bar, baz");

we solved the problem this way for iOS 8.1.2 / cordova 4.1.2

sebglazebrook commented 9 years ago

I'm also seeing this.

The code I had was working when I was on iOS 7.1.2 but now on iOS 8.1.3 I don't see success or error callbacks being called.

I'm using version 2.4.0 of the plugin

brahmikumar commented 9 years ago

I'm also same problem, Notification perfectly working in iOS 8.1.1 version, but in iOS 8.1.3 version registration working and getting token id also, but onNotificationAPN function not excecutes.

I'm using xoced 6, and cordova 3.6.3, push plugin is https://github.com/wildpeaks/PushPlugin.

sameid commented 9 years ago

I am also receiving the same issue, and my app was rejected for not receiving push notifications on iPad running iOS 8.1.3. I can't even test in that environment. Although the push notifications are working on my iPhone 4S running iOS 8.1.3.

Anyone know anything... did something change with the core api?

okonon commented 9 years ago

same issue here :(

OS: Mac OS X Yosemite
Node Version: v0.10.26
Cordova CLI: 4.2.0
Ionic CLI Version: 1.3.11
Xcode version: Xcode 6.1.1 Build version 6A2008a 
ios-sim version: 3.1.1 
taidv commented 9 years ago

I am also receiving the same issue. On notificationReceived() method trigged, i received notificationMessage value but self.callback is nil

OS: 10.9.5 Xcode version: 6.1.1 Cordova: 4.2.0 iOS: 8.1.3

billwolckenlmco commented 9 years ago

Newer versions of the Cordova iOS platorm implement application:didRegisterForRemoteNotificationsWithDeviceToken: and application:didFailToRegisterForRemoteNotificationsWithError: on AppDelegate and broadcast the message via NSNotificationCenter. This plugin is also implementing those two methods on AppDelegate via a category. According to Apple's docs (section "Avoid Category Method Name Clashes" in https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/CustomizingExistingClasses/CustomizingExistingClasses.html), in this situation "the behavior is undefined as to which method implementation is used at runtime". So in some situations the base Cordova implementations could be called and the token or error never gets delivered to the plugin. The plugin really needs to not implement those two methods but register with NSNotificationCenter for the broadcast of them instead.

billwolckenlmco commented 9 years ago

The didRegister... and didFailToRegister... were added to AppDelegate in Cordova iOS platform version 3.5, but it appears they are being removed and moved to a separate Cordova Notification Rebroadcast plugin for platform version 4.0. The Rebroadcast plugin is using the swizzle + call original pattern, so there should be no conflict. So the method conflict issue is only when using the current version of this plugin with iOS platforms 3.5 through 3.8.