Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/96.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 尝试使用Parse.com获取推送通知在设备上不工作_Ios_Iphone_Parse Platform_Push Notification - Fatal编程技术网

Ios 尝试使用Parse.com获取推送通知在设备上不工作

Ios 尝试使用Parse.com获取推送通知在设备上不工作,ios,iphone,parse-platform,push-notification,Ios,Iphone,Parse Platform,Push Notification,所以我正在尝试Parse.com推送通知服务 我已经完成了所有步骤等,当我尝试在模拟器上运行时,应用程序会运行,但当我尝试在我的Iphone设备Iphone 5s上运行时,应用程序会崩溃,错误代码如下: 015-01-08 17:28:45.607 PickMeUp[451:60b] -[UIApplication registerForRemoteNotifications]: unrecognized selector sent to instance 0x1576016f

所以我正在尝试Parse.com推送通知服务

我已经完成了所有步骤等,当我尝试在模拟器上运行时,应用程序会运行,但当我尝试在我的Iphone设备Iphone 5s上运行时,应用程序会崩溃,错误代码如下:

015-01-08 17:28:45.607 PickMeUp[451:60b] -[UIApplication registerForRemoteNotifications]:         
unrecognized selector sent to instance 0x1576016f0
2015-01-08 17:28:45.610 PickMeUp[451:60b] *** Terminating app 
due to uncaught exception 'NSInvalidArgumentException', reason: 
'-[UIApplication registerForRemoteNotifications]: unrecognized selector sent to instance 0x1576016f0'
这是密码

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.

[Parse setApplicationId:@""];

// Register for Push Notitications
UIUserNotificationType userNotificationTypes = (UIUserNotificationTypeAlert |
                                                UIUserNotificationTypeBadge |
                                                UIUserNotificationTypeSound);
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:userNotificationTypes

                                                                         categories:nil];
[application registerUserNotificationSettings:settings]; // The app crashes here
[application registerForRemoteNotifications];



return YES;
}

编辑

我的iphone没有完全更新。版本是7.1

试试这个

    // Register for Push Notitications
    if ([application respondsToSelector: @selector (registerUserNotificationSettings :)]) {
          UIUserNotificationSettings * settings = [UIUserNotificationSettings settingsForTypes: UIUserNotificationTypeBadge | UIUserNotificationTypeAlert | UIUserNotificationTypeSound
                                                                                   categories: nil ];
           [[UIApplication sharedApplication] registerUserNotificationSettings: settings];
           [[UIApplication sharedApplication] registerForRemoteNotifications];
       } else {
           //ios7
           [[UIApplication sharedApplication] registerForRemoteNotificationTypes:
            UIRemoteNotificationTypeBadge |
            UIRemoteNotificationTypeAlert |
            UIRemoteNotificationTypeSound];

       }
试试这个

    // Register for Push Notitications
    if ([application respondsToSelector: @selector (registerUserNotificationSettings :)]) {
          UIUserNotificationSettings * settings = [UIUserNotificationSettings settingsForTypes: UIUserNotificationTypeBadge | UIUserNotificationTypeAlert | UIUserNotificationTypeSound
                                                                                   categories: nil ];
           [[UIApplication sharedApplication] registerUserNotificationSettings: settings];
           [[UIApplication sharedApplication] registerForRemoteNotifications];
       } else {
           //ios7
           [[UIApplication sharedApplication] registerForRemoteNotificationTypes:
            UIRemoteNotificationTypeBadge |
            UIRemoteNotificationTypeAlert |
            UIRemoteNotificationTypeSound];

       }

这对我不起作用,但它让我朝着正确的方向前进,经过几天的搜索,我找到了另一个堆栈链接: .
添加了它,一切都很好。

这对我不起作用,但它让我朝着正确的方向前进,经过几天的搜索,我找到了另一个堆栈链接: .
添加了它,一切正常。

在C99@TonyMkenu中,函数“selector”的隐式减容无效,并且:使用未声明的标识符“registerUserNotificationSettings”;你是说“UIUserNotificationSettings”吗?对不起,请更新代码,输入错误的选择器-必须是@selector哇,它成功了,谢谢!。你能解释一下它为什么起作用吗?另外,如果我想让它在ios 6上运行,我在哪里可以检查写什么呢@TonyMkenuYou可以在任何iOS版本中使用此代码,而无需任何修改。TksImplicit decelleration函数“selector”在C99@TonyMkenu中无效,并且:使用未声明的标识符“registerUserNotificationSettings”;你是说“UIUserNotificationSettings”吗?对不起,请更新代码,输入错误的选择器-必须是@selector哇,它成功了,谢谢!。你能解释一下它为什么起作用吗?另外,如果我想让它在ios 6上运行,我在哪里可以检查写什么呢@TonyMkenuYou可以在任何iOS版本中使用此代码,而无需任何修改。这应该是一个注释。这应该是一个注释。