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

**URL:** <https://forum.ionicframework.com/t/push-plugin-no-valid-aps-environment-with-ionic-run-on-ios/89083>\
**Category:** ionic-v3\
**Created:** [May 5, 2017, 1:24pm UTC](https://forum.ionicframework.com/t/push-plugin-no-valid-aps-environment-with-ionic-run-on-ios/89083 "2017-05-05T13:24:08Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![grizzmock](https://avatars.discourse-cdn.com/v4/letter/g/e19b73/32.png) [@grizzmock](https://forum.ionicframework.com/u/grizzmock)\
**Post date:** [May 5, 2017, 1:24pm UTC](https://forum.ionicframework.com/t/push-plugin-no-valid-aps-environment-with-ionic-run-on-ios/89083/1 "2017-05-05T13:24:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [May 5, 2017, 4:49pm UTC](https://forum.ionicframework.com/t/push-plugin-no-valid-aps-environment-with-ionic-run-on-ios/89083/2 "2017-05-05T16:49:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![swaps747](https://avatars.discourse-cdn.com/v4/letter/s/df705f/32.png) [@swaps747](https://forum.ionicframework.com/u/swaps747)\
**Post date:** [May 6, 2017, 10:21am UTC](https://forum.ionicframework.com/t/push-plugin-no-valid-aps-environment-with-ionic-run-on-ios/89083/3 "2017-05-06T10:21:29Z")

</div>

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](https://developer.apple.com/library/content/documentation/IDEs/Conceptual/AppDistributionGuide/AddingCapabilities/AddingCapabilities.html)

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [May 6, 2017, 1:07pm UTC](https://forum.ionicframework.com/t/push-plugin-no-valid-aps-environment-with-ionic-run-on-ios/89083/4 "2017-05-06T13:07:51Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![grizzmock](https://avatars.discourse-cdn.com/v4/letter/g/e19b73/32.png) [@grizzmock](https://forum.ionicframework.com/u/grizzmock)\
**Post date:** [May 9, 2017, 7:24am UTC](https://forum.ionicframework.com/t/push-plugin-no-valid-aps-environment-with-ionic-run-on-ios/89083/5 "2017-05-09T07:24:59Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [May 9, 2017, 8:09am UTC](https://forum.ionicframework.com/t/push-plugin-no-valid-aps-environment-with-ionic-run-on-ios/89083/6 "2017-05-09T08:09:34Z")

</div>

Normally you add the ID via the install command:  
[https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/INSTALLATION.md#installation-requirements](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?

---

<div class="post-metadata">

**Author:** ![grizzmock](https://avatars.discourse-cdn.com/v4/letter/g/e19b73/32.png) [@grizzmock](https://forum.ionicframework.com/u/grizzmock)\
**Post date:** [May 11, 2017, 1:32pm UTC](https://forum.ionicframework.com/t/push-plugin-no-valid-aps-environment-with-ionic-run-on-ios/89083/7 "2017-05-11T13:32:41Z")

</div>

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

config.xml

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

```

package.json

```auto
...
  "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:

```auto
  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

---

<div class="post-metadata">

**Author:** ![MarinoRaul](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/marinoraul/32/103586_2.png) [@MarinoRaul](https://forum.ionicframework.com/u/MarinoRaul)\
**Post date:** [May 13, 2017, 11:19pm UTC](https://forum.ionicframework.com/t/push-plugin-no-valid-aps-environment-with-ionic-run-on-ios/89083/8 "2017-05-13T23:19:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![MaxHOA](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/maxhoa/32/109730_2.png) [@MaxHOA](https://forum.ionicframework.com/u/MaxHOA)\
**Post date:** [May 23, 2017, 5:40pm UTC](https://forum.ionicframework.com/t/push-plugin-no-valid-aps-environment-with-ionic-run-on-ios/89083/9 "2017-05-23T17:40:43Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![harding](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/harding/32/89001_2.png) [@harding](https://forum.ionicframework.com/u/harding)\
**Post date:** [August 9, 2017, 7:22am UTC](https://forum.ionicframework.com/t/push-plugin-no-valid-aps-environment-with-ionic-run-on-ios/89083/10 "2017-08-09T07:22:33Z")

</div>

Finally did anyone find the solution?

---

<div class="post-metadata">

**Author:** ![nandy0111](https://avatars.discourse-cdn.com/v4/letter/n/df705f/32.png) [@nandy0111](https://forum.ionicframework.com/u/nandy0111)\
**Post date:** [August 17, 2017, 11:21am UTC](https://forum.ionicframework.com/t/push-plugin-no-valid-aps-environment-with-ionic-run-on-ios/89083/11 "2017-08-17T11:21:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![TaeKwonJoe](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/taekwonjoe/32/106474_2.png) [@TaeKwonJoe](https://forum.ionicframework.com/u/TaeKwonJoe)\
**Post date:** [May 2, 2018, 11:49pm UTC](https://forum.ionicframework.com/t/push-plugin-no-valid-aps-environment-with-ionic-run-on-ios/89083/12 "2018-05-02T23:49:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![montesleo](https://avatars.discourse-cdn.com/v4/letter/m/b19c9b/32.png) [@montesleo](https://forum.ionicframework.com/u/montesleo)\
**Post date:** [September 7, 2019, 8:21pm UTC](https://forum.ionicframework.com/t/push-plugin-no-valid-aps-environment-with-ionic-run-on-ios/89083/13 "2019-09-07T20:21:45Z")

</div>

… it has happened to me that ionic run stops working when my physical device is plugged in to the mac, even though I’m specifying to run on the XS Simulator…

… if you look closely in the logs, when an iPhone is plugged in, the build process seems to try and deploy in the device instead of in the sim… unplugged the iPhone and ionic run works fine in the simulator…
