未收到IOS推送通知

时间:2015-10-19 13:56:51

标签: php python ios push-notification apple-push-notifications

我配置了我的应用:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="100dp"
    android:orientation="vertical"
    android:weightSum="1">
        <TextView
            android:id="@+id/name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="16dp"
            android:textColor="#ffffff"
            android:text="Example Example"
            android:textSize="14sp"
            android:textStyle="bold"
            android:layout_centerVertical="true"
            android:layout_alignStart="@+id/email" />

        <TextView
            android:id="@+id/email"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="#ffffff"
            android:layout_marginLeft="16dp"
            android:text="example@gmail.com"
            android:textSize="14sp"
            android:textStyle="normal"
            android:layout_alignBottom="@+id/circleView"
            android:layout_toEndOf="@+id/circleView" />

    <de.hdodenhof.circleimageview.CircleImageView
        android:layout_width="60dip"
        android:layout_height="60dip"
        android:src="@drawable/ic_face_white_48dp"
        android:layout_marginLeft="20dp"
        android:layout_marginTop="20dp"
        android:id="@+id/circleView"
        android:layout_alignParentTop="true"
        android:layout_alignParentStart="true" />
</RelativeLayout>

将我的设备令牌复制到我的python脚本:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        // Override point for customization after application launch.
        let pushSettings: UIUserNotificationSettings = UIUserNotificationSettings(
                forTypes:[.Alert, .Badge, .Sound],
                categories: nil)
            UIApplication.sharedApplication().registerUserNotificationSettings(pushSettings)
            UIApplication.sharedApplication().registerForRemoteNotifications()
        return true
    }

func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
        print("My token is: \(deviceToken)");
    }

    // Failed to register for Push
    func application(application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: NSError) {
        print("Failed to get token; error: %@", error) //Log an error for debugging purposes, user doesn't need to know
    }

我运行脚本,它没有返回错误,但我没有在我的Ipad收到通知。我尝试了这个tutorial的php脚本,脚本返回“消息已成功发送”,但我仍然没有收到任何消息。 Php code here

任何想法如何调试或出错?

0 个答案:

没有答案