PHP API中的Parse推送通知未在parse.com仪表板中注册为"已打开"

时间:2015-11-03 18:20:38

标签: php ios objective-c parse-platform apple-push-notifications

何时使用Parse PHP API将Push Notifications发送给iOS上的用户。但是,出于某种原因,我们没有注册任何" Push Opens"对于我们的任何用户。以下是我们使用的PHP代码:

$query = ParseInstallation::query();
$query->equalTo("user_id", $user_id);
$pushResponse = ParsePush::send(array(
  "where" => $query,
  "push_time" => $push_time,
  "expiration_interval" => $expiration_interval,
  "data" => array(
    "alert" => $alert,
    "badge" => 1,
    "ota" => : array(
        "type" => 2,
     )
));

enter image description here

在iOS中,我确保处理通知:

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
    if (application.applicationState == UIApplicationStateInactive) {
        [PFPush handlePush:userInfo];
        [PFAnalytics trackAppOpenedWithRemoteNotificationPayload:userInfo];
        [self processNotification:userInfo];
    }
}

application:didFinishLaunchingWithOptions:

if (application.applicationState != UIApplicationStateBackground) {
    BOOL preBackgroundPush = ![application respondsToSelector:@selector(backgroundRefreshStatus)];
    BOOL oldPushHandlerOnly = ![self respondsToSelector:@selector(application:didReceiveRemoteNotification:fetchCompletionHandler:)];
    BOOL noPushPayload = ![launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
    if (preBackgroundPush || oldPushHandlerOnly || noPushPayload) {
        [PFAnalytics trackAppOpenedWithLaunchOptions:launchOptions];
    }
}

是否有一些我错过的内容会让Parse知道特定用户是否打开了推送通知?

1 个答案:

答案 0 :(得分:0)

取决于您拥有的用户数量:用户不会通过推送通知打开应用程序。许多用户在收到通知后,可以忽略它或通过触摸主屏幕上的应用程序图标打开应用程序。

您应该向测试设备发送通知,并确保使用该通知打开该应用。然后你可以检查Parse是否跟踪应用程序正确打开。