Cordova如何删除iOS上的"推送通知"

Tro*_*han 13 feedback push-notification ios cordova

我使用Apache Cordova将我的应用程序提交到Apple Store,我从苹果那里收到一条警告:"缺少推送通知权限".

但似乎我从未在我的应用程序中使用"推送通知".如何从我的应用程序中删除它?它是Apache Cordova的默认设置吗?

Ste*_*las 18

如何为CORDOVA APPS"正确"做到这一点:

我也有这个问题.@michaelb提出的解决方案有效,但我很沮丧地看到整个事情都包含在条件编译中(即#ifndef DISABLE_PUSH_NOTIFICATIONS)我决定学习如何添加'预处理器宏',这基本上告诉XCode使用这个位编译你的应用程序代码遗漏了.

这就是你如何DISABLE_PUSH_NOTIFICATIONS通过UI以图形方式定义预编译符号(注意这是在XCode 6.1中完成的方式):

在此输入图像描述

希望这能帮助其他人在同样的情况下.


Kle*_*nko 5

在AppDelegate.m中删除didRegisterForRemoteNotificationsWithDeviceToken和didFailToRegisterForRemoteNotificationsWithError.致力于PhoneGap 3.5


mic*_*lbn 5

按照上面和其他地方的建议,这就是我在Cordova 5.0.0中所做的

结果警告消失了,我没有注意到App的任何问题.

  1. 打开平台/ ios/InfoganGardenAdmin/Classes/AppDelegate.m
  2. 注释掉第116到137行

例:

/* - Removed to disable push notification and Apple warning message
#ifndef DISABLE_PUSH_NOTIFICATIONS

    - (void)                                 application:(UIApplication*)application
        didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
    {
        // re-post ( broadcast )
        NSString* token = [[[[deviceToken description]
            stringByReplacingOccurrencesOfString:@"<" withString:@""]
            stringByReplacingOccurrencesOfString:@">" withString:@""]
            stringByReplacingOccurrencesOfString:@" " withString:@""];

        [[NSNotificationCenter defaultCenter] postNotificationName:CDVRemoteNotification object:token];
    }

    - (void)                                 application:(UIApplication*)application
        didFailToRegisterForRemoteNotificationsWithError:(NSError*)error
    {
        // re-post ( broadcast )
        [[NSNotificationCenter defaultCenter] postNotificationName:CDVRemoteNotificationError object:error];
    }
#endif
*/
Run Code Online (Sandbox Code Playgroud)