iOS not receiving push notifications

I followed the instructions here to set up push notifications for iOS, with a bit of changes since the instructions were only for Swift. I also configured push notifications to “on” in the capabilities section. After that, I created a simple test app that would send out a push notification when a button was pressed. However, when I ran it on my device, no notification was received. I’ve tried changing the code signing settings several times, but it either does nothing, or Xcode throws an error and resets them. In another test app that was virtually identical, I got the push notifications to work, but I must’ve changed something in the settings, because when I tried it again, nothing happened. Similarly, notifications sent from the console aren’t received either.
One thing is that the team id used for my app ids matches my iOS distribution certificate, not my iOS development, so I initially created a production profile to use with this app instead of a development, but neither of them worked in the end.
This is my AppDelegate code:


class AppDelegate: UIResponder, UIApplicationDelegate {
 let APP_ID = "[app id]"
 let SECRET_KEY = "[key]"
 let VERSION_NUM = "v1"
 
 var backendless = Backendless.sharedInstance()
 
 var window: UIWindow?
 func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
 backendless.initApp(APP_ID, secret:SECRET_KEY, version:VERSION_NUM)
 backendless.messaging.registerForRemoteNotifications()
 return true
 }
 
 func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
 backendless.messaging.registerDeviceToken(deviceToken)
 backendless.messaging.registerDevice(["default"])
 }
}

This is my ViewController:


class ViewController: UIViewController {
 @IBAction func pressed(sender: AnyObject) {
 Backendless.sharedInstance().messaging.publish("default", message: "Hello world")
 }
 
 override func viewDidLoad() {
 super.viewDidLoad()
 // Do any additional setup after loading the view, typically from a nib.
 }
 override func didReceiveMemoryWarning() {
 super.didReceiveMemoryWarning()
 // Dispose of any resources that can be recreated.
 }
}

And this is what my code signing settings looks like:
http://support.backendless.com/public/attachments/d7cabd5d1a5b7e0dd4b96566d24e2960.png</img>
Several things that I tried were:

    Selecting the production profile for the provisioning profile and changing the code-signing values to iPhone Distribution. Xcode threw an error and reset the values. Selecting the development profile and changing code-signing values to iPhone Developer. Also an error, and values were reset. Changing values to iOS Developer instead. Also an error. Changing values to iOS Distribution instead. Error. Changed to production profile. Error. Changed values to iOS Developer again without changing profile. Error. Changed values to iPhone Developer. Again, error.
Specifically, the error said: "Your build settings specify a provisioning profile with the UUID “<...>”, however, no such provisioning profile was found." When I tried setting the profile to Automatic and the code-signing values to iPhone Distribution or iOS Distribution, the error was: "None of the valid provisioning profiles include the devices: <my device>". It seems that the only setup Xcode allowed was iPhone Developer/iOS Developer with Automatic for the provisioning profile. I've been at a dead end for several hours with this. How can I make push notifications work properly in my app?

Please try our sample project (see in attachment) with your Bundle Identifier and AppID & secretKey.

Use it as example to organize your project.
Also see this doc.

TestPushNotify.zip (19.55MB)

And you need the provisioning profile for this Bundle ID.

I downloaded the project, changed the bundle id to match my provisioning profile, and changed the appid and secret key, but I didn’t receive any notifications. This is what was printed to the console:

didRegisterForRemoteNotificationsWithDeviceId: 078AB4A7-8DFA-47AA-FFF6-E24CE9E41A00









PUBLISHED

Message has been sent: &lt;MessageStatus&gt; messageId: 356D7D06-D89B-826E-FF2E-CAE36EF7E200, status: SCHEDULED errorMessage: (null)

RECEIVED: Optional(Tester) -> ONE

But you received notification!
Line 4 in your log is associated with IBEPushReceiver delegate (lines 124-126 in ViewController.swift):

    func didReceiveRemoteNotification(notification: String!, headers: [NSObject : AnyObject]!) {
        print("RECEIVED: \(headers["publisher_name"]) -> \(notification)")
    }

It didn’t show up on the screen of my device though. Do I need to write extra code for that?

Sure, only you know what your app have to do.

You receive a push notification message in didReceiveRemoteNotification(notification:headers:) delegate, and then you can do with it what you need.

Our sample project shows the simplest implementation without UI.

Is there a simple way to make the received notification display like an ordinary push notification, like this? I got the notification to display like this on a previous test, but I can’t remember what I did differently.

http://i.stack.imgur.com/Fz8DV.png</img>

You could try to download our Code Generation sample for messaging, it should contain sample code.

I tried the code generation sample. One thing was that I was unable to download a Swift version even though I selected Swift, and though I got the obj-c version running, all it did was display the notification as text on the screen. What I want is basically the default Apple push notification that shows up on the opening screen of your phone like this:

http://i.stack.imgur.com/krV2i.jpg</img>
if it’s received when the user’s phone is sleeping, or just pops up on the top of the screen if it’s received while the user’s phone is open. I’m not aiming for anything fancy or customized, just something that can alert the user of new information.

Sorry, but we can’t help you write your app’s code on this support forum. Though, this is available with our professional services: https://backendless.com/professional-services/