I'm trying to set up iOS Push Notifications and I've been going round in circles for the past 4 hours and got nowhere.
The app is written in Swift 2.3.
I set up the AppBoy application...
Appboy.startWithApiKey("blahblahblahblah", inApplication:application, withLaunchOptions:launchOptions)
And I can see that there are users of the iOS app in the segment I created.
In code I then register for notifications and use this code to send the device token up to AppBoy...
extension NSData {
func hexString() -> String {
// "Array" of all bytes:
let bytes = UnsafeBufferPointer<UInt8>(start: UnsafePointer(self.bytes), count:self.length)
// Array of hex strings, one for each byte:
let hexBytes = bytes.map { String(format: "%02hhx", $0) }
// Concatenate all hex strings:
return hexBytes.joinWithSeparator("")
}
}
And this...
func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
let token = deviceToken.hexString()
Appboy.sharedInstance()?.registerPushToken(token)
}
However, when I update the filter on the Segment in AppBoy to filter by "Push Enabled" I get 0 devices. (I'm not even sure if Push Enabled is the correct filter?)
As a secondary question. The certificate that I upload to AppBoy is telling me it is a "Universal certificate" and the newest method of delivering notifications. Is this the right certificate to upload to AppBoy?
I have created a campaign with the segment I created and it shows as having one message delivered.
But whatever I do nothing is coming through to my device.
The version of the app installed on my device is the one downloaded and installed through Crashlytics.
Thanks
Update
OK, so now I'm getting devices showing up as "Push Enabled" but when I try to send a push notification the error log in the developer console shows "Error sending to a bad push token..."
The certificate I have shows like this...
Can anyone explain what I'm doing wrong? I have followed every troubleshooting guide and triple checked the setup and redone every step several times.