5

I have followed steps mentioned at this answer for creating development certificate and provision profile. I am trying to implement FCM and running Nativescript application in real device. Following are the steps I have followed to build project :

  1. Imported provision with appbuilder provision import path/to/provision
  2. Installed development certificate in the key-chain.
  3. Exported .p12 file and saved to local disk.
  4. Imported certificate with appbuilder certificate import path/to/p12/cert
  5. Creating build with appbuilder build ios --provision "XXXX" --certificate "XXXX"

But it does give me error

Certificate is not included in provision's certificates

Please correct me if i did anything wrong. Do suggest some solution if you have been through this as i am new to this stuff and Nativescript.

P.S. I also tried giving provision to appbuilder site it also shows some warning in certificate field

Here is APNS permission

enter image description here


UPDATE:


As mentioned by @Eddy Verbruggen (Author NativeScript Firebase plugin)

I asked Telerik after this email and they confirmed it's a bug in their browser client and hope to have it fixed soon. They created a ticket for it.

Community
  • 1
  • 1
Hardik Vaghani
  • 2,119
  • 21
  • 40

2 Answers2

2

In tutorial he didn't check push notification in app id please ensure that in your app id you enabled Push notification as screenshot and has green circle

enter image description here

Hosny
  • 691
  • 1
  • 13
  • 23
1

Certificate is not included in provision's certificates

This error message is usually generated when there are no matching public keys in the .mobileprovision profile with the cryptographic identity that you use.

You can validate that the .mobileprovison is bind to this particular certificate by extracting the .p12 public key and search for a match under the <key>DeveloperCertificates</key> array in the .mobileprovison's xml portion.

You could extract the public key from the .p12 cryptographic identity by using openssl.

openssl pkcs12 -in <path_to_.p12> -clcerts -nokeys -out <path_to_resulting_public_key.pem> && cat <path_to_resulting_public_key.pem>

Once you know the public key, verify that it is listed under the <key>DeveloperCertificates</key> in your .mobileprovison file. You can do this by either running the command below or simply open .mobileprovision with text editor such as notepad++

security cms -D -i <path_to_.mobileprovision> | grep -f <path_to_resulting_public_key.pem>

I'd also recommend to delete all .mobileprovision files and certificates from your appbuilder profile and then re-import the items in question. You can do this by running the following commands:

appbuilder certificate // List certificates 
appbuilder certificate remove <name or index> // Delete cerificates
appbuilder provision // List provisions
appbuilder provision remove <provision_id> // Delete provisions 
appbuilder provision remove <provision_id> // Delete provisions 
appbuilder provision import path/to/provision
appbuilder certificate import path/to/p12/cert

EDIT:
NOTE: You might also find interesting the following {N} plugin - https://github.com/NativeScript/push-plugin

Steps on how to generate a APNS certificate and a mobileprovision file.

  • Verify that you have created and added a pair of matching certificate and provisioning profile in AppBuilder. For more information about certificates and provisioning profiles, see Configuring Code Signing for iOS Apps.
  • Verify that the App ID in the provisioning profile is enabled for push notifications. In the Identifiers section in the iOS Developer Center, select your identifier from the list and review the enabled services. If needed, click Edit and enable the missing functionality. If you modify an existing App ID, make sure to recreate the matching provisioning profile and import it into AppBuilder.
  • Verify that you have set the proper App ID for your application in the Project Properties dialog.
  • Verify that you have created an Apple Push Notification service SSL certificate in the Certificates section in the iOS Developer Center and added it in AppBuilder.
  • Verify that the type of the Apple Push Notification service SSL certificate matches the type of your certificate and provisioning profile for code signing your app. For example, both should be for development or for production.
  • Verify that you have exported the P12 file for the Apple Push Notification service SSL cryptographic identity. For more information about how to export cryptographic identities from AppBuilder, see Export a Cryptographic Identity.
e2l3n
  • 500
  • 1
  • 7
  • 15
  • I think its not listed as i tried some of line and find in data block. Can you help me with how to generate profile with matching .pem file ? – Hardik Vaghani Oct 13 '16 at 11:37
  • Edited the answer. I hope this helps. – e2l3n Oct 14 '16 at 09:26
  • About the plugin you referenced, its working fine if i don't have to navigate to different pages. But i have requirement where based on notification type and payload i have to navigate. This plugin don' t provide application state so that i can know if app is in foreground then i don't have to navigate and if app is in background and i click on notification then app should open particular page. – Hardik Vaghani Oct 18 '16 at 06:27