来自PHP API的解析推送通知未在Parse.com仪表板中注册为;开放式;
当您使用来自PHP API的解析推送通知未在Parse.com仪表板中注册为;开放式;,php,ios,objective-c,parse-platform,apple-push-notifications,Php,Ios,Objective C,Parse Platform,Apple Push Notifications,当您使用ParsePHP API向iOS上的用户发送Push通知时。但是,由于某些原因,我们没有为任何用户注册任何“推送打开”。下面是我们正在使用的PHP代码: $query = ParseInstallation::query(); $query->equalTo("user_id", $user_id); $pushResponse = ParsePush::send(array( "where" => $query, "push_time" => $push_ti
Parse
PHP API向iOS
上的用户发送Push通知时。但是,由于某些原因,我们没有为任何用户注册任何“推送打开”。下面是我们正在使用的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];
}
}
在应用程序中:使用选项完成启动:
:
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
知道某个特定用户打开了推送通知的内容?取决于您拥有的用户数量:用户不可能通过推送通知打开应用程序。许多用户在收到通知后,要么忽略通知,要么通过触摸主屏幕上的应用图标打开应用
您应该向测试设备发送通知,并确保使用该通知打开应用程序。然后,您可以检查Parse是否正确打开应用程序