-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
106 lines (87 loc) · 5.74 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="UTF-8">
<title>OneSignal Push Notification for iOS</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#157878">
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="/onesignal-push-notification-ios/assets/css/style.css?v=7ffd375541b28b307c38d1eb58e50837ce0d112e">
</head>
<body>
<section class="page-header">
<h2 class="project-name">OneSignal Push Notification</h2>
<h2 class="project-tagline">How to Setup OneSignal Push Notification to Your Apps for iOS</h2>
<a href="http://batuhan.me/onesignal-push-notification-ios/tr.html" class="btn">Türkçe</a>
<a href="http://batuhan.me/onesignal-push-notification-ios/" class="btn">English</a>
<a href="http://www.batuhan.me" class="btn">Personal Site</a>
</section>
<section class="main-content">
<blockquote>
<p>Hey,</p>
<p>I know, Push Notification can be so annoying problem for iOS developers. However, OneSignal makes your life easy to
sending notifications by using web interface of OneSignal. The installing process is a little bit hard, so, I have
written here to make your life easier!</p>
</blockquote>
<ol>
<li>Go to <a href="https://www.onesignal.com">onesignal.com</a>
<ol>
<li>Login and click the <strong>Create a new app</strong></li>
<li>Select <strong>Apple iOS (APNS)</strong></li>
</ol>
</li>
<li>Open new tab, go to <a href="https://www.onesignal.com/provisionator">onesignal.com/provisionator</a>
<ol>
<li>Click <strong>Get Started</strong></li>
<li>Login with your Apple Developer Account</li>
<li>Select your app that you want to use push notification, click <strong>Generate</strong></li>
<li>Click <strong>Download .p12 File</strong> and <strong><em>copy the password</em></strong></li>
</ol>
</li>
<li>Turn back to the <a href="https://www.onesignal.com">onesignal.com</a>’s tab
<ol>
<li>Select the file that you have just downloaded</li>
<li>Paste the password to the related input, click <strong>Save</strong></li>
<li>Select <strong>Native iOS</strong>, then copy <strong>Your App ID</strong> <code class="highlighter-rouge">(like: 5eb5a37e-b458-11e3-ac11-000c2940e62c)</code></li>
</ol>
</li>
<li>
<p>You can close the web browser</p>
</li>
<li>Open the <strong>terminal</strong> (hint: you can push CMD + Space and write terminal…)
<ol>
<li>Write, <code class="highlighter-rouge">cd </code> and drag drop the your app folder to the terminal, press enter</li>
<li>It has to seem like this: <code class="highlighter-rouge">cd /Users/***/Desktop/XcodeApps/***\ ***</code></li>
<li>Write, <code class="highlighter-rouge">pod init</code>, then press enter</li>
<li>Write, <code class="highlighter-rouge">open Podfile</code>, then press enter</li>
<li>Write between <code class="highlighter-rouge">do</code> - <code class="highlighter-rouge">and</code>, <code class="highlighter-rouge">pod 'OneSignal'</code> to the file that did opened and save it</li>
<li>Write, <code class="highlighter-rouge">pod install</code>, then press enter</li>
</ol>
</li>
<li>Then open your project with clicking <strong>example.xcworkspace</strong>
<ol>
<li>Open <strong>Capabilities</strong> tab, Push capability: switch on</li>
<li>Background Capability: switch on</li>
<li>In the Background Capability, remote push notification: switch on</li>
</ol>
</li>
<li>Then, edit your <strong>AppDelegate.swift</strong> like above:</li>
</ol>
<div class="language-swift highlighter-rouge">
<pre class="highlight"><code><span class="kd">import</span> <span class="kt">OneSignal</span>
<span class="kd">func</span> <span class="nf">application</span><span class="p">(</span><span class="nv">application</span><span class="p">:</span> <span class="kt">UIApplication</span><span class="p">,</span> <span class="n">didFinishLaunchingWithOptions</span> <span class="nv">launchOptions</span><span class="p">:</span> <span class="p">[</span><span class="kt">NSObject</span><span class="p">:</span> <span class="kt">AnyObject</span><span class="p">]?)</span> <span class="o">-></span> <span class="kt">Bool</span> <span class="p">{</span>
<span class="c1">//Add this line. Replace '5eb5a37e-b458-11e3-ac11-000c2940e62c' with your OneSignal App ID (you have just copied.)</span>
<span class="kt">OneSignal</span><span class="o">.</span><span class="nf">initWithLaunchOptions</span><span class="p">(</span><span class="n">launchOptions</span><span class="p">,</span> <span class="nv">appId</span><span class="p">:</span> <span class="s">"5eb5a37e-b458-11e3-ac11-000c2940e62c"</span><span class="p">)</span>
<span class="k">return</span> <span class="kc">true</span>
<span class="p">}</span>
</code></pre>
</div>
<h3 id="thats-all-brilliant-">That’s all, brilliant 🎉</h3>
<h4 id="good-luck-">Good luck 😊💪</h4>
<footer class="site-footer">
<span class="site-footer-owner"><a href="https://github.com/batuhankok/onesignal-push-notification-ios">onesignal-push-notification-ios</a> is maintained by <a href="https://github.com/batuhankok">batuhankok</a>.</span>
<span class="site-footer-credits">This page was generated by <a href="https://pages.github.com">GitHub Pages</a>.</span>
</footer>
</section>
</body>
</html>