[ 
https://issues.apache.org/jira/browse/CB-8084?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14308916#comment-14308916
 ] 

ASF GitHub Bot commented on CB-8084:
------------------------------------

Github user ligaz commented on a diff in the pull request:

    https://github.com/apache/cordova-ios/pull/128#discussion_r24230887
  
    --- Diff: bin/templates/scripts/cordova/lib/push-notifications.js ---
    @@ -0,0 +1,82 @@
    +(function () {
    +    var fs = require('fs'),
    +        path = require('path'),
    +        exec = require('child_process').exec,
    +        PUSH_NOTIFICATIONS_ENABLED_HEADER_FILE = 
'PushNotificationsEnabled.h',
    +        PUSH_NOTIFICATIONS_ENABLED_HEADER_FILE_CONTENT = '#define 
PUSH_NOTIFICATIONS_ENABLED ',
    +        EXPANDED_PROVISIONING_PROFILE = 
process.env.EXPANDED_PROVISIONING_PROFILE,
    +        PATH_TO_MOBILE_PROVISIONS = path.join(process.env.HOME, 'Library', 
'MobileDevice', 'Provisioning Profiles'),
    +        PROVISIONING_PROFILE_REQUIRED = 
process.env.PROVISIONING_PROFILE_REQUIRED,
    +        PROVISIONING_PROFILE_UUID_REGEX = new 
RegExp('<key>UUID<\/key>[\\s\\S]*<string>' + EXPANDED_PROVISIONING_PROFILE + 
'<\/string>');
    +
    +    function logErrorIfExists(error) {
    +        if (error !== null) {
    +            console.error('ERROR: ' + error);
    +        }
    +    }
    +
    +    function sanitizeMobileProvision(mobileProvision) {
    +        if (mobileProvision.indexOf('.mobileprovision') === -1) {
    +            mobileProvision += '.mobileprovision';
    +        }
    +
    +        return mobileProvision;
    +    }
    +
    +    function createPushNotificationsEnabledHeaderFile(pushPluginsEnabled) {
    +        var cordovaEnablePluginHeaderFileLocation = path.join(__dirname, 
'..', '..', process.env.PROJECT_NAME, 'Classes', 
PUSH_NOTIFICATIONS_ENABLED_HEADER_FILE);
    +        fs.writeFileSync(cordovaEnablePluginHeaderFileLocation, 
PUSH_NOTIFICATIONS_ENABLED_HEADER_FILE_CONTENT + pushPluginsEnabled);
    +    }
    +
    +    function 
createPushNotificationsEnabledHeaderFileWithMobileProvision(mobileProvision) {
    +        var pathToProvisioningProfile = 
path.join(PATH_TO_MOBILE_PROVISIONS, sanitizeMobileProvision(mobileProvision));
    +
    +        exec("security cms -D -i \"" + pathToProvisioningProfile + "\"", 
function (error, stdout, stderr) {
    +            logErrorIfExists(error);
    +            var pushPluginsEnabled = 
stdout.indexOf("<key>aps-environment</key>") > -1;
    --- End diff --
    
    The variable name should be something like 
`hasPushNotificationsEntitlement` :smile: 


> Push Notifications code included by default
> -------------------------------------------
>
>                 Key: CB-8084
>                 URL: https://issues.apache.org/jira/browse/CB-8084
>             Project: Apache Cordova
>          Issue Type: Bug
>    Affects Versions: 3.5.0
>            Reporter: Jacob Weber
>
> When creating a new Cordova app using the CLI, it adds code to AppDelegate.m 
> for Push Notifications. This causes Apple to issue a warning when you submit 
> the app, if your provisioning profile doesn't have Push Notifications enabled:
> {quote}
> Missing Push Notification Entitlement - Your app appears to include API used 
> to register with the Apple Push Notification service, but the app signature's 
> entitlements do not include the "aps-environment" entitlement. If your app 
> uses the Apple Push Notification service, make sure your App ID is enabled 
> for Push Notification in the Provisioning Portal, and resubmit after signing 
> your app with a Distribution provisioning profile that includes the 
> "aps-environment" entitlement. See "Provisioning and Development" in the 
> Local and Push Notification Programming Guide for more information. If your 
> app does not use the Apple Push Notification service, no action is required. 
> You may remove the API from future submissions to stop this warning. If you 
> use a third-party framework, you may need to contact the developer for 
> information on removing the API.
> {quote}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to