Skip to content

Build in release mode for iOS doesn't seem to set the production mode for APN #2888

Closed

Description

@gprodanov

Did you verify this is a real problem by searching Stack Overflow and the other open issues in this repo?

Yes.

Tell us about the problem

I'm trying to submit an app to the Apple store, but am unable to receive a push notification when building with ad-hoc provisioning profile and a production push notifications certificate. The app uses angular and AOT compilation. It's, of course, possible that I'm missing something.

The app builds, deploys and runs properly, with the exception that when I send a push notification (using the production setup and certificate), the device is marked as disabled and the notification is never received. If I use the development setup (sandbox and certificate), the app receives the notification. So I'm guessing the entitlement's "mode" is not set to production, even though I attempted to set it manually, but to no effect. I guess xcode is supposed to handle this?

Which platform(s) does your issue occur on?

iOS

Please provide the following version numbers that your issue occurs with:

  • CLI: 3.0.1
  • Cross-platform modules: 2.5.1
  • Runtime(s): 2.5.0 for both runtimes
  • Plugin(s):
    "nativescript-angular": "1.4.1",
    "nativescript-imagepicker": "2.5.2",
    "nativescript-permissions": "1.2.3",
    "nativescript-push-notifications": "0.1.2",
    "nativescript-telerik-ui": "1.6.1",
    "nativescript-theme-core": "0.1.5",

Please tell us how to recreate the issue in as much detail as possible.

I'm building the app with the following command:
tns build ios --bundle --disable-npm-install --release --for-device
Then I take the .ipa file and put it on iTunes, and from there sync it to a device. Then send a push notification to that device and it is not received. The device is then marked as "disabled" in APN.

If I build the app this way, then build/run it in release mode through xcode, the app works as expected. This is the approach I will use to submit the app to the store, for the time being.

Is there code involved? If so, please share the minimal amount of code needed to recreate the problem.

There's an entire app, but it can be as small as you like, as long as it features push notifications.

Activity

  1. PeterStaev commented on Jun 14, 2017

    @PeterStaev
    Contributor

    Actually I've just experienced this with a non-angular app as well. I have no idea how XCode sets the "prodcution" mode for the push notifications but seems the CLI is missing something.

    I've set the aps-environment to production in my entitlements, I'm using tns build ios --for-device --release, I've also verified that the provision profile in the IPA is the AdHoc one and that in the profile the aps-environment is also set to production. Still the device registers with the sandbox service and receives the push only when it is sent with the Development push certificate...

  2. dtopuzov commented on Jul 3, 2017

    @dtopuzov
    Contributor

    @georgiwe @PeterStaev We had similar issue and we fixed it in CLI 3.1.1

    Can you please test with nativescript@3.1.1?

  3. PeterStaev commented on Jul 5, 2017

    @PeterStaev
    Contributor

    @dtopuzov I've just tested and the problem still persists with CLI 3.1.1.

    I do not think the issue you linked is related, as the entitlements are not in the Info.plist file so they are not merged from what I understand.

    Also note that after the project is prepared by the CLI, if I open the Xcode solution and just change the default Run scheme to use Release instead of Debug and deploy to device from there w/o doing any other changes, the device correctly registers with the production APN environment. That's why I suspect some option is not sent correctly to whatever the CLI uses to build and archive the app.

  4. added this to the 3.2.0 milestone on Jul 5, 2017
  5. PeterStaev commented on Jul 24, 2017

    @PeterStaev
    Contributor

    Could be related to #2999

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions