何时使用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,
)
));
在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
知道特定用户是否打开了推送通知?
答案 0 :(得分:0)
取决于您拥有的用户数量:用户不会通过推送通知打开应用程序。许多用户在收到通知后,可以忽略它或通过触摸主屏幕上的应用程序图标打开应用程序。
您应该向测试设备发送通知,并确保使用该通知打开该应用。然后你可以检查Parse是否跟踪应用程序正确打开。