DKCode DKCode - 6 months ago 54
Swift Question

Xcode6 Swift add Remote Push Notifications and send from PHP

I want to send Push Notifications via a PHP script to all app users. About Google Unfortunately there are no tutorials for Push Notifications with Swift. I do not want to use. Can anyone help me please?


OK now it works ! (:

Create Certificate for APN:

Swift Code:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {

    // Override point for customization after application launch.

    var type = UIUserNotificationType.Badge | UIUserNotificationType.Alert | UIUserNotificationType.Sound

    var setting = UIUserNotificationSettings(forTypes: type, categories: nil)



    return true


func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {



func application(application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: NSError) {



find the deviceToken in the Xcode Console

PHP Script

use the PHP Script from here (scroll down)

run the PHP Script and viola (: