解析通知不';我不能在iOS上工作

解析通知不';我不能在iOS上工作,ios,objective-c,parse-platform,notifications,Ios,Objective C,Parse Platform,Notifications,我试图在我的iOS应用程序中使用解析通知,我一步一步地遵循parse.com网站上的指南,但它仍然不起作用,这是我的app delegate.m - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [Parse enableLocalDatastore]; // Initialize Parse.

我试图在我的iOS应用程序中使用解析通知,我一步一步地遵循parse.com网站上的指南,但它仍然不起作用,这是我的app delegate.m

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{



    [Parse enableLocalDatastore];

    // Initialize Parse.
    [Parse setApplicationId:@"XXXXXXXXXXXX"
                  clientKey:@"XXXXXXXXXXX"];




    // [Optional] Track statistics around application opens.
    [PFAnalytics trackAppOpenedWithLaunchOptions:launchOptions];


    NSLog(@"START");
    // Register for Push Notitications
    UIUserNotificationType userNotificationTypes = (UIUserNotificationTypeAlert |
                                                    UIUserNotificationTypeBadge |
                                                    UIUserNotificationTypeSound);

    if ([application respondsToSelector:@selector(isRegisteredForRemoteNotifications)])
    {
        // iOS 8 Notifications
        [application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];

        [application registerForRemoteNotifications];
    }
    else
    {
        // iOS < 8 Notifications
        [application registerForRemoteNotificationTypes:
         (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound)];
    }

       [self grabStoryboard];
    [FBLoginView class];
    [FBProfilePictureView class];


    return YES;
}


- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
    // Store the deviceToken in the current installation and save it to Parse.
    PFInstallation *currentInstallation = [PFInstallation currentInstallation];
    [currentInstallation setDeviceTokenFromData:deviceToken];
    [currentInstallation saveInBackground];
}

- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
    if (error.code == 3010) {
        NSLog(@"Push notifications are not supported in the iOS Simulator.");
    } else {
        // show some alert or otherwise handle the failure to register.
        NSLog(@"application:didFailToRegisterForRemoteNotificationsWithError: %@", error);
    }
}

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
    [PFPush handlePush:userInfo];
}
-(BOOL)应用程序:(UIApplication*)应用程序使用选项完成启动:(NSDictionary*)启动选项
{
[Parse enableLocalDatastore];
//初始化解析。
[解析setApplicationId:@“XXXXXXXXXXXXX”
客户端密钥:@“xxxxxxxxxx”];
//[可选]围绕应用程序打开的跟踪统计信息。
[PFAnalytics trackAppOpenedWithLaunchOptions:launchOptions];
NSLog(@“开始”);
//推送通知寄存器
UIUserNotificationType userNotificationTypes=(UIUserNotificationTypeAlert|
UIUserNotificationTypeBadge|
UIUserNotificationTypeSound);
if([application respondsToSelector:@selector(isRegisteredForRemoteNotifications)])
{
//iOS 8通知
[应用程序注册表通知设置:[UIUserNotificationSettings设置类型:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge)类别:无];
[申请登记处证明];
}
其他的
{
//iOS<8通知
[应用程序注册信息类型:
(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound)];
}
[自抓情节提要];
[FBLoginView类];
[FBProfilePictureView类];
返回YES;
}
-(无效)应用程序:(UIApplication*)应用程序DIdRegisterForRemotionTificationswithDeviceToken:(NSData*)deviceToken{
//将deviceToken存储在当前安装中并保存以进行解析。
PFInstallation*currentInstallation=[PFInstallation currentInstallation];
[currentInstallation setDeviceTokenFromData:deviceToken];
[当前安装保存背景];
}
-(无效)应用程序:(UIApplication*)应用程序未能注册远程通知,错误为:(N错误*)错误{
如果(错误代码==3010){
NSLog(@“iOS模拟器中不支持推送通知”);
}否则{
//显示一些警报或以其他方式处理注册失败。
NSLog(@“应用程序:DidFailToRegister for RemoteNotifications,错误:%@”,错误);
}
}
-(无效)应用程序:(UIApplication*)应用程序DidReceiveMemotentification:(NSDictionary*)用户信息{
[PFPush-handlePush:userInfo];
}

在parse.com上,我看到我已经注册了1台设备,但是当我点击“发送推送”时,推送发送的是0

你应该在parse上检查你的应用程序设置。转到推送通知,查看您是否上传了正确的证书(Apple推送证书)。这应该可以解决您的问题。

将其添加到did注册远程通知部分

[currentInstallation setObject:[PFUser currentUser].objectId forKey:@"owner"];
你的推送地址加上这个

PFQuery *pushQuery = [PFInstallation query];
[pushQuery whereKey:@"owner" containedIn:self.recipients];

此外,如果这不起作用,请向我展示您发送推送的方法

是的,我使用与我的应用程序相同的捆绑标识上传了推送