{"id":3669,"date":"2017-09-07T09:57:07","date_gmt":"2017-09-07T09:57:07","guid":{"rendered":"http:\/\/www.nikola-breznjak.com\/blog\/?p=3669"},"modified":"2017-09-07T09:58:44","modified_gmt":"2017-09-07T09:58:44","slug":"use-fastlane-pem-automatically-generate-renew-voip-push-notification-profiles","status":"publish","type":"post","link":"https:\/\/nikola-breznjak.com\/blog\/ios\/use-fastlane-pem-automatically-generate-renew-voip-push-notification-profiles\/","title":{"rendered":"How to use fastlane pem to automatically generate and renew your VoIP push notification profiles"},"content":{"rendered":"<p>In the previous tutorial, I showed you how easy it is to <a href=\"http:\/\/www.nikola-breznjak.com\/blog\/ios\/use-fastlane-pem-automatically-generate-renew-push-notification-profiles\/\">use fastlane pem to automatically generate and renew your push notification profiles<\/a>.<\/p>\n<p>In this tutorial, I&#8217;ll do the same thing, but for VoIP notifications. I found the solution in <a href=\"https:\/\/github.com\/fastlane\/fastlane\/issues\/7059\">this Github issue<\/a>.<\/p>\n<p>In your project&#8217;s root folder create a new folder called <code>fastlane<\/code>.<\/p>\n<p>Then, create a file called <code>Fastfile<\/code> in the <code>fastlane<\/code> folder.<\/p>\n<p>Put the following content into <code>Fastfile<\/code>:<\/p>\n<pre><code>lane :voip_cert do\n    app_identifier = \"com.nikola.mygreatapp\"\n    apple_id = \"mylogin@apple.com\"\n    output_path = \".\"\n    p12_password = \"password\"\n\n    UI.important \"Creating a new push certificate for app '#{app_identifier}'.\"\n\n    Spaceship.login(apple_id)\n    Spaceship.client.select_team\n    csr, pkey = Spaceship::Certificate.create_certificate_signing_request\n    cert = Spaceship::Certificate::VoipPush.create!(csr:csr,bundle_id:app_identifier)\n\n    x509_certificate = cert.download\n    certificate_type = \"voippush\"\n    filename_base = \"#{certificate_type}_#{app_identifier}\"\n\n    p12_cert_path = File.join(output_path, \"#{filename_base}.p12\")\n    p12 = OpenSSL::PKCS12.create(p12_password, certificate_type, pkey, x509_certificate)\n    File.write(p12_cert_path, p12.to_der)\n    UI.message(\"p12 certificate: \".green + Pathname.new(p12_cert_path).realpath.to_s)\n\n    x509_cert_path = File.join(output_path, \"#{filename_base}.pem\")\n    File.write(x509_cert_path, x509_certificate.to_pem + pkey.to_pem)\n    UI.message(\"PEM: \".green + Pathname.new(x509_cert_path).realpath.to_s)\nend\n<\/code><\/pre>\n<p>Make sure you enter the appropriate <code>app_identifier<\/code> and <code>apple_id<\/code> and <code>password<\/code> (if you&#8217;re using it).<\/p>\n<p>Execute the following command from your app&#8217;s root directory:<\/p>\n<p><code>fastlane voip_cert<\/code><\/p>\n<p>You should see something like this in the output:<\/p>\n<pre><code>nikola in ~\/DEV\/TheOnlyAppThatMatters on git:feature\/make-app-great-again \u2716\ufe0e [06:06:06]\n\u2192 fastlane voip_cert\n[06:06:06]: Get started using a Gemfile for fastlane https:\/\/docs.fastlane.tools\/getting-started\/ios\/setup\/#use-a-gemfile\n[06:06:06]: Driving the lane 'voip_cert' ?\n[06:06:06]: Creating a new push certificate for app 'com.nikola.mygreatapp'.\n[06:06:06]: p12 certificate: \/Users\/nikola\/DEV\/TheOnlyAppThatMatters\/fastlane\/voippush_com.nikola.mygreatapp.p12\n[06:06:06]: PEM: \/Users\/nikola\/DEV\/TheOnlyAppThatMatters\/fastlane\/voippush_com.nikola.mygreatapp.pem\n[06:06:06]: fastlane.tools finished successfully ?\n<\/code><\/pre>\n<p>And that&#8217;s it! Hope this proves to be helpful for you! ?<\/p>\n<blockquote class=\"twitter-tweet\" data-width=\"550\">\n<p lang=\"en\" dir=\"ltr\">How to use fastlane pem to automatically generate and renew your <a href=\"https:\/\/twitter.com\/hashtag\/VoIP?src=hash\">#VoIP<\/a> push notification profiles <a href=\"https:\/\/t.co\/AvbKkbhRWD\">https:\/\/t.co\/AvbKkbhRWD<\/a><\/p>\n<p>&mdash; Nikola Bre\u017enjak (@HitmanHR) <a href=\"https:\/\/twitter.com\/HitmanHR\/status\/905731870435966976\">September 7, 2017<\/a><\/p><\/blockquote>\n<p><script async src=\"\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"><\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the previous tutorial, I showed you how easy it is to use fastlane pem to automatically generate and renew your push notification profiles. In this tutorial, I&#8217;ll&hellip;<\/p>\n","protected":false},"author":1,"featured_media":3670,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[52],"tags":[],"class_list":["post-3669","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ios"],"_links":{"self":[{"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/posts\/3669","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/comments?post=3669"}],"version-history":[{"count":2,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/posts\/3669\/revisions"}],"predecessor-version":[{"id":3672,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/posts\/3669\/revisions\/3672"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/media\/3670"}],"wp:attachment":[{"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/media?parent=3669"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/categories?post=3669"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/tags?post=3669"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}