App rejected because of “Missing Push Notification Entitlement”

后端 未结 10 1651
余生分开走
余生分开走 2020-11-27 04:07

Recently my application got rejected while uploading it. The Apple review team says my app is \"Missing Push Notification Entitlements\"

This is the information they

10条回答
  •  眼角桃花
    2020-11-27 04:26

    If you are submitting a Cordova / Phonegap project and you are NOT using push notifications, you should inspect Classes/AppDelegate.m for the two methods below. Observed in Cordova 3.7.0, not sure about other versions.

    Make sure you are not using remote notifications in any other way (carefully check your plugins as well). Then remove or comment out the following block:

    - (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];
    }
    

    Hope this saves you a few hours ;-)

提交回复
热议问题