Push Plugin, no valid 'aps-environment' with "ionic run" on iOS


#1

Hi all,

i have an app using Push-Plugin. On iOS i have the problem that the app failed to initialize the push plugin when i use the ionic cli with “ionic run ios”:

Error: no valid ‘aps-environment’ entitlement string found for application

When i open the project in xcode and run/install the app from there all work fine.
Somebody any idea what the problem can be?

Thanks a lot
Chris


#2

What plugin are you using and how did you install it?
Maybe quick and dirty fix: Remove the ios platform and add it again. This resets all the created stuff, sometimes helps to fix issues.


#3

Go to Xcode -> Target -> Capabilities Tab -> Turn on “push notifications” …

For reference see this doc
https://developer.apple.com/library/content/documentation/IDEs/Conceptual/AppDistributionGuide/AddingCapabilities/AddingCapabilities.html


#4

That’s the manual way, for sure. Shouldn’t the push plugin normally take care of this automatically in the background when being added to the platform/project?


#5

I have installed the plugin over the command line:

cordova plugin add phonegap-plugin-push

and configure the sender id in the config.xml


I have already tried to remove the ios platform and add it again and also to configure push notifications over the Xcode, but both don’t effect the error when i run/build the application over the ionic cli. Over xcode-build all is fine…


#6

Normally you add the ID via the install command:
https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/INSTALLATION.md#installation-requirements
Also at the end of this “headline”, before “Android details”, all taken care of?

By the way, which version of the plugin are you using?


#7

I have now remove the platform and the plugin and followed the mentioned article.
I have now the following entries created:

config.xml

    <plugin name="phonegap-plugin-push" spec="~1.10.3">        
<variable name="SENDER_ID" value="xxxxxxx" />    
</plugin>

package.json

...
  "cordovaPlugins": [
     {
      "variables": {
        "SENDER_ID": "xxxx"
      },
      "locator": "phonegap-plugin-push"
    },
    "cordova-plugin-whitelist",
    "cordova-plugin-console",
    "cordova-plugin-statusbar",
    "cordova-plugin-device",
    "cordova-plugin-splashscreen",
    "ionic-plugin-keyboard"
  ],
...

the code to register the app:

  const pushOptions: PushOptions = {
      android: {
        senderID: 'xxxxx',
        "sound": true,
        "forceShow": true
      },
      ios: {
        alert: 'true',
        badge: true,
        sound: 'false'
      }
    };

    const pushObject: PushObject = this.push.init(pushOptions);
    
    pushObject.on('registration').subscribe((data: any) => {
      //never called
    });

Android: all fine
ios: the same error

Additional ideas?
Thanks a lot


#8

Did you resolve this issue? I have the same problem with ionic package and muy certificates and profiles are ok


#9

Did anyone find a solution to this?

I installed the same plugin and did all the same things and I get a message from apple whenever I submit my .ipa built with ionic package.

Missing Push Notification Entitlement - Your app appears 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. Xcode 8 does not automatically copy the aps-environment entitlement from provisioning profiles at build time. This behavior is intentional. To use this entitlement, either enable Push Notifications in the project editor’s Capabilities pane, or manually add the entitlement to your entitlements file.


#10

Finally did anyone find the solution?


#11

If you are running your app in iphone using “ionic run ios” then this will also cause the same problem.
SOLUTION:- instead you must run your ios app using XCODE to install app into iphone.
SOLVED MY PROBLEM


#12

I am using “pushwoosh-cordova-plugin” v6.5.0 and get this error when attempting to register my device with the provider plugin:

Error Domain=NSCocoaErrorDomain Code=3000 "no valid “aps-environment” entitlement string found for application" UserInfo={NSLocalizedDescription=no valid “aps-environment” entitlement string found for application}

I haven’t seen any solution yet such as setting push notification entitlements with config.xml somehow so I put in an Ionic Pro support ticket.

Cordova iOS 4.5.4
iPhone7/iOS11.2.7