Site icon บริษัท โค๊ดบี จำกัด

iOS application วิธีสร้างไฟล์ .pem สำหรับใช้งาน push notification บน iOS

<h3>iOS application วิธีสร้างไฟล์ &period;pem สำหรับใช้งาน push notification บน iOS application<&sol;h3>&NewLine;<p><amp-youtube layout&equals;"responsive" width&equals;"958" height&equals;"539" data-videoid&equals;"FV0Fv64Qk80" title&equals;"Unity C&num; ทดสอบการส่ง iOS Push notification"><a placeholder href&equals;"https&colon;&sol;&sol;www&period;youtube&period;com&sol;watch&quest;v&equals;FV0Fv64Qk80"><img src&equals;"https&colon;&sol;&sol;i&period;ytimg&period;com&sol;vi&sol;FV0Fv64Qk80&sol;hqdefault&period;jpg" layout&equals;"fill" object-fit&equals;"cover" alt&equals;"Unity C&num; ทดสอบการส่ง iOS Push notification"><&sol;a><&sol;amp-youtube><&sol;p>&NewLine;<p>1&period; login เข้าไปที่ https&colon;&sol;&sol;developer&period;apple&period;com&sol;account&sol;ios&sol;certificate&sol;<&sol;p>&NewLine;<p>2&period; ไปที่หัวข้อ Identifiers เพื่อสร้าง id แต่ถ้าหากมีไอดีอยู่แล้วก็ข้ามขั้นตอนนี้ไปได้เลย<br &sol;>&NewLine;ในการสร้าง id ของแอพ ติ๊กถูกที่ push notification<br &sol;>&NewLine;<img src&equals;"http&colon;&sol;&sol;codebee&period;co&period;th&sol;labs&sol;wp-content&sol;uploads&sol;2016&sol;05&sol;วิธีสร้างไฟล์-pem-สำหรับ-push-notification-1&period;png" alt&equals;"วิธีสร้างไฟล์ &period;pem สำหรับใช้งาน push notification บน iOS application" &sol;><br &sol;>&NewLine;<&excl;--more--><&sol;p>&NewLine;<p><img src&equals;"http&colon;&sol;&sol;codebee&period;co&period;th&sol;labs&sol;wp-content&sol;uploads&sol;2016&sol;05&sol;วิธีสร้างไฟล์-pem-สำหรับ-push-notification-2&period;png" alt&equals;"วิธีสร้างไฟล์ &period;pem สำหรับใช้งาน push notification บน iOS application" &sol;><&sol;p>&NewLine;<p>3&period; หลังจากได้ id แล้วให้ไปสร้าง certificate โดยกดเครื่องหมายบวกที่เมนูนี้<&sol;p>&NewLine;<p><img src&equals;"http&colon;&sol;&sol;codebee&period;co&period;th&sol;labs&sol;wp-content&sol;uploads&sol;2016&sol;05&sol;วิธีสร้างไฟล์-pem-สำหรับ-push-notification-0&period;png" alt&equals;"วิธีสร้างไฟล์ &period;pem สำหรับใช้งาน push notification บน iOS application" &sol;><&sol;p>&NewLine;<p>&&num;8211&semi; หากต้องการใช้งานแบบ development ให้เลือก Apple Push Notification service SSL &lpar;Sandbox&rpar;<br &sol;>&NewLine;&&num;8211&semi; หากต้องการใช้งานแบบ production ให้เลือก Apple Push Notification service SSL &lpar;Sandbox &amp&semi; Production&rpar;<br &sol;>&NewLine;จากนั้นให้เลือก id ที่เราเพิ่งสร้างไว้ก่อนหน้านี้คือ com&period;codebee&period;testpush และกด continue<br &sol;>&NewLine;<img src&equals;"http&colon;&sol;&sol;codebee&period;co&period;th&sol;labs&sol;wp-content&sol;uploads&sol;2016&sol;05&sol;วิธีสร้างไฟล์-pem-สำหรับ-push-notification-9&period;png" alt&equals;"วิธีสร้างไฟล์ &period;pem สำหรับใช้งาน push notification บน iOS application" &sol;><&sol;p>&NewLine;<p>4&period; มาถึงขั้นตอนนี้ทาง apple จะให้เราสร้างไฟล์ &period;certSigningRequest และอัพโหลดขึ้นไป<br &sol;>&NewLine;<img src&equals;"http&colon;&sol;&sol;codebee&period;co&period;th&sol;labs&sol;wp-content&sol;uploads&sol;2016&sol;05&sol;วิธีสร้างไฟล์-pem-สำหรับ-push-notification-3&period;png" alt&equals;"วิธีสร้างไฟล์ &period;pem สำหรับใช้งาน push notification บน iOS application" &sol;><&sol;p>&NewLine;<p>วิธีสร้างไฟล์ &period;certSigningRequest ก็ทำตามขั้นตอนต่อไปนี้ครับ<br &sol;>&NewLine;&&num;8211&semi; เปิดโปรแกรม keychain access<br &sol;>&NewLine;&&num;8211&semi; ไปที่เมนู Keychain Access-&gt&semi;Certificate Assistant<br &sol;>&NewLine;&&num;8211&semi; เลือกไปที่ Request a certificate from Certificate Authority<br &sol;>&NewLine;<img src&equals;"http&colon;&sol;&sol;codebee&period;co&period;th&sol;labs&sol;wp-content&sol;uploads&sol;2016&sol;05&sol;วิธีสร้างไฟล์-pem-สำหรับ-push-notification-4&period;png" alt&equals;"วิธีสร้างไฟล์ &period;pem สำหรับใช้งาน push notification บน iOS application" &sol;><&sol;p>&NewLine;<p>&&num;8211&semi; กรอกรายละเอียด อีเมล ชื่อ และเลือก saved to disk กด continue เราจะได้ไฟล์ &period;certSigningRequest<br &sol;>&NewLine;<img src&equals;"http&colon;&sol;&sol;codebee&period;co&period;th&sol;labs&sol;wp-content&sol;uploads&sol;2016&sol;05&sol;วิธีสร้างไฟล์-pem-สำหรับ-push-notification-5&period;png" alt&equals;"วิธีสร้างไฟล์ &period;pem สำหรับใช้งาน push notification บน iOS application" &sol;><&sol;p>&NewLine;<p>5&period; หลังจากได้ไฟล์ &period;certSigningRequest ให้กลับมาที่หน้า upload ของ apple กดเลือกไฟล์ &period;certSigningRequest ที่เราสร้างไว้และอัพโหลด กด continue และกดดาวน์โหลดไฟล์ &period;cer<br &sol;>&NewLine;<img src&equals;"http&colon;&sol;&sol;codebee&period;co&period;th&sol;labs&sol;wp-content&sol;uploads&sol;2016&sol;05&sol;วิธีสร้างไฟล์-pem-สำหรับ-push-notification-6&period;png" alt&equals;"วิธีสร้างไฟล์ &period;pem สำหรับใช้งาน push notification บน iOS application" &sol;><&sol;p>&NewLine;<p>6&period; หลังจากจบขั้นตอนที่ 5 เราจะได้ฟล์ aps&lowbar;development&period;cer มาให้ดับเบิ้ลคลิกที่ไฟล์เพื่อ install ใน keychain<&sol;p>&NewLine;<p>7&period; เปิดโปรแกรม keychain access เลือกไปที่ login และ category เป็น Certificate<br &sol;>&NewLine;หา Certificate ที่ตรงกับของเรา<&sol;p>&NewLine;<pre class&equals;"lang&colon;tex decode&colon;true ">Apple Development iOS Push Service&colon;com&period;codebee&period;testpush<&sol;pre>&NewLine;<p>Apple Development iOS Push Service&colon;com&period;codebee&period;testpush หรือไอดีที่ท่านเป็นคนสร้าง<&sol;p>&NewLine;<p>8&period; จากนั้นกด expand และเลือกทั้ง 2 ไอเทม กด Export 2 items เพื่อ export ไฟล์ &period;p12<br &sol;>&NewLine;ทำการเซฟชื่อไฟล์ไว้ที่ desktop ตั้งชื่อว่า pushcert&period;p12<br &sol;>&NewLine;ในขั้นตอนนี้ จะมีให้ใส่ password ด้วย แต่เราจะไม่ใส่ก็ได้ สามารถข้ามได้<&sol;p>&NewLine;<p><img src&equals;"http&colon;&sol;&sol;codebee&period;co&period;th&sol;labs&sol;wp-content&sol;uploads&sol;2016&sol;05&sol;วิธีสร้างไฟล์-pem-สำหรับ-push-notification-7&period;png" alt&equals;"วิธีสร้างไฟล์ &period;pem สำหรับใช้งาน push notification บน iOS application" &sol;><&sol;p>&NewLine;<p>9&period; จากนั้นเปิดโปรแกรม Terminal พิมพ์คำสั่งดังนี้ครับ<&sol;p>&NewLine;<pre class&equals;"theme&colon;terminal lang&colon;tex decode&colon;true ">cd Desktop &NewLine;openssl pkcs12 -in pushcert&period;p12 -out pushcert&period;pem -nodes -clcerts<&sol;pre>&NewLine;<p>เป็นอันเรียบร้อยครับ ท่านก็จะเห็นไฟล์ pushcert&period;pem อยู่บน desktop เครื่องของท่าน<br &sol;>&NewLine;ขั้นตอนต่อไปก็จะเป็นการนำไฟล์ &period;pem ไปใช้งานร่วมกับ php หรือภาษาอื่น ๆ ในการส่ง push notification<&sol;p>&NewLine;

Exit mobile version