From 66e2c03a4b441a4cdb27916ece36dce501b315b7 Mon Sep 17 00:00:00 2001 From: olivercarson-pubnub <98775701+olivercarson-pubnub@users.noreply.github.com> Date: Fri, 15 Jul 2022 08:56:55 -0700 Subject: [PATCH 1/7] Updated readme --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 248311b..9972392 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +## IN PROGRESS ## + # Samples for PubNub Chat Components for iOS This repository contains a set of iOS projects that will help you learn about PubNub Chat Components for iOS. From 76ee42f17794ad586a81e2e06deec871c3731ed2 Mon Sep 17 00:00:00 2001 From: olivercarson-pubnub Date: Fri, 15 Jul 2022 12:05:53 -0700 Subject: [PATCH 2/7] Create Singleton PubNub Object & Cleanup Created Singleton class PubNubConnection to be used as a single instance to be used across all screens. Updated base code to use new object & generate UUID. --- .../getting-started.xcodeproj/project.pbxproj | 29 +++++++++++++++++++ .../contents.xcworkspacedata | 7 +++++ .../xcshareddata/IDEWorkspaceChecks.plist | 8 +++++ .../getting-started/PubNubConnection.swift | 23 +++++++++++++++ .../getting-started/SceneDelegate.swift | 21 +++----------- 5 files changed, 71 insertions(+), 17 deletions(-) create mode 100644 getting-started/getting-started.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 getting-started/getting-started.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 getting-started/getting-started/PubNubConnection.swift diff --git a/getting-started/getting-started.xcodeproj/project.pbxproj b/getting-started/getting-started.xcodeproj/project.pbxproj index 27fb89c..5bc8d5e 100644 --- a/getting-started/getting-started.xcodeproj/project.pbxproj +++ b/getting-started/getting-started.xcodeproj/project.pbxproj @@ -15,6 +15,9 @@ 357AB6D92790E2A200E2839B /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 357AB6D72790E2A200E2839B /* LaunchScreen.storyboard */; }; 357AB6E22790E8F600E2839B /* PubNubChat in Frameworks */ = {isa = PBXBuildFile; productRef = 357AB6E12790E8F600E2839B /* PubNubChat */; }; 357AB6E42790E8F600E2839B /* PubNubChatComponents in Frameworks */ = {isa = PBXBuildFile; productRef = 357AB6E32790E8F600E2839B /* PubNubChatComponents */; }; + CD6A16832881EC1200D2139E /* PubNubConnection.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD6A16822881EC1200D2139E /* PubNubConnection.swift */; }; + CD6A16862881EFBF00D2139E /* PubNubChat in Frameworks */ = {isa = PBXBuildFile; productRef = CD6A16852881EFBF00D2139E /* PubNubChat */; }; + CD6A16882881EFBF00D2139E /* PubNubChatComponents in Frameworks */ = {isa = PBXBuildFile; productRef = CD6A16872881EFBF00D2139E /* PubNubChatComponents */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -26,6 +29,7 @@ 357AB6D52790E2A200E2839B /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 357AB6D82790E2A200E2839B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 357AB6DA2790E2A200E2839B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + CD6A16822881EC1200D2139E /* PubNubConnection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PubNubConnection.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -34,6 +38,8 @@ buildActionMask = 2147483647; files = ( 357AB6E42790E8F600E2839B /* PubNubChatComponents in Frameworks */, + CD6A16862881EFBF00D2139E /* PubNubChat in Frameworks */, + CD6A16882881EFBF00D2139E /* PubNubChatComponents in Frameworks */, 357AB6E22790E8F600E2839B /* PubNubChat in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -67,6 +73,7 @@ 357AB6D52790E2A200E2839B /* Assets.xcassets */, 357AB6D72790E2A200E2839B /* LaunchScreen.storyboard */, 357AB6DA2790E2A200E2839B /* Info.plist */, + CD6A16822881EC1200D2139E /* PubNubConnection.swift */, ); path = "getting-started"; sourceTree = ""; @@ -90,6 +97,8 @@ packageProductDependencies = ( 357AB6E12790E8F600E2839B /* PubNubChat */, 357AB6E32790E8F600E2839B /* PubNubChatComponents */, + CD6A16852881EFBF00D2139E /* PubNubChat */, + CD6A16872881EFBF00D2139E /* PubNubChatComponents */, ); productName = "getting-started"; productReference = 357AB6C92790E2A100E2839B /* getting-started.app */; @@ -121,6 +130,7 @@ mainGroup = 357AB6C02790E2A000E2839B; packageReferences = ( 357AB6E02790E8F600E2839B /* XCRemoteSwiftPackageReference "chat-components-ios" */, + CD6A16842881EFBF00D2139E /* XCRemoteSwiftPackageReference "chat-components-ios" */, ); productRefGroup = 357AB6CA2790E2A100E2839B /* Products */; projectDirPath = ""; @@ -150,6 +160,7 @@ buildActionMask = 2147483647; files = ( 357AB6D12790E2A100E2839B /* ViewController.swift in Sources */, + CD6A16832881EC1200D2139E /* PubNubConnection.swift in Sources */, 357AB6CD2790E2A100E2839B /* AppDelegate.swift in Sources */, 357AB6CF2790E2A100E2839B /* SceneDelegate.swift in Sources */, ); @@ -380,6 +391,14 @@ minimumVersion = 0.0.0; }; }; + CD6A16842881EFBF00D2139E /* XCRemoteSwiftPackageReference "chat-components-ios" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/pubnub/chat-components-ios"; + requirement = { + branch = master; + kind = branch; + }; + }; /* End XCRemoteSwiftPackageReference section */ /* Begin XCSwiftPackageProductDependency section */ @@ -393,6 +412,16 @@ package = 357AB6E02790E8F600E2839B /* XCRemoteSwiftPackageReference "chat-components-ios" */; productName = PubNubChatComponents; }; + CD6A16852881EFBF00D2139E /* PubNubChat */ = { + isa = XCSwiftPackageProductDependency; + package = CD6A16842881EFBF00D2139E /* XCRemoteSwiftPackageReference "chat-components-ios" */; + productName = PubNubChat; + }; + CD6A16872881EFBF00D2139E /* PubNubChatComponents */ = { + isa = XCSwiftPackageProductDependency; + package = CD6A16842881EFBF00D2139E /* XCRemoteSwiftPackageReference "chat-components-ios" */; + productName = PubNubChatComponents; + }; /* End XCSwiftPackageProductDependency section */ }; rootObject = 357AB6C12790E2A000E2839B /* Project object */; diff --git a/getting-started/getting-started.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/getting-started/getting-started.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/getting-started/getting-started.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/getting-started/getting-started.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/getting-started/getting-started.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/getting-started/getting-started.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/getting-started/getting-started/PubNubConnection.swift b/getting-started/getting-started/PubNubConnection.swift new file mode 100644 index 0000000..65b4df4 --- /dev/null +++ b/getting-started/getting-started/PubNubConnection.swift @@ -0,0 +1,23 @@ +// +// PubNubObj.swift +// getting-started +// +// Used to provide a globally accessible, shared instance of a class. +// Useful for adding more screens to application. +// Created by Oliver Carson on 7/14/22. +// + +import Foundation +import PubNub + +final class PubNubConnection { + private static let PUBNUB_PUBLISH_KEY = "pub-c-7ae1c68f-8009-470a-83d6-b14848591f3a" + private static let PUBNUB_SUBSCRIBE_KEY = "sub-c-a7cb2610-ad18-4a4a-a5db-188271558045" + static let shared : PubNub = PubNub( + configuration: PubNubConfiguration( + publishKey: PUBNUB_PUBLISH_KEY, + subscribeKey: PUBNUB_SUBSCRIBE_KEY, + uuid: String(NSUUID().uuidString.prefix(6)) // UUID will be first 6 characters + )) + private init() {} +} diff --git a/getting-started/getting-started/SceneDelegate.swift b/getting-started/getting-started/SceneDelegate.swift index 5371e07..749a302 100644 --- a/getting-started/getting-started/SceneDelegate.swift +++ b/getting-started/getting-started/SceneDelegate.swift @@ -11,20 +11,8 @@ import PubNub import PubNubChat import PubNubChatComponents -let PUBNUB_PUBLISH_KEY = "myPublishKey" -let PUBNUB_SUBSCRIBE_KEY = "myPublishKey" - class SceneDelegate: UIResponder, UIWindowSceneDelegate { - - // Creates PubNub configuration - lazy var pubnubConfiguration = { - return PubNubConfiguration( - publishKey: PUBNUB_PUBLISH_KEY, - subscribeKey: PUBNUB_SUBSCRIBE_KEY, - uuid: "myFirstUser" - ) - }() - + var pubNub = PubNubConnection.shared var window: UIWindow? var chatProvider: PubNubChatProvider? @@ -42,7 +30,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { if chatProvider == nil { // Creates a new ChatProvider let provider = PubNubChatProvider( - pubnubProvider: PubNub(configuration: pubnubConfiguration) + pubnubProvider: pubNub ) // Preloads dummy data @@ -77,14 +65,14 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { // Creates a user object with uuid let user = PubNubChatUser( id: chatProvider.pubnubConfig.uuid, - name: "myFirstUser", + name: chatProvider.pubnubConfig.uuid, avatarURL: URL(string: "https://picsum.photos/seed/\(chatProvider.pubnubConfig.uuid)/200") ) // Creates a channel object let channel = PubNubChatChannel( id: defaultChannelId, - name: "Default", + name: defaultChannelId, type: "direct", avatarURL: URL(string: "https://picsum.photos/seed/\(defaultChannelId)/200") ) @@ -99,4 +87,3 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { chatProvider.dataProvider.load(members: [membership]) } } - From b4c045e66c84b29635478e28de5da15b64b6a72a Mon Sep 17 00:00:00 2001 From: olivercarson-pubnub Date: Fri, 15 Jul 2022 12:54:04 -0700 Subject: [PATCH 3/7] Update PubNubConnection with generic strings --- getting-started/getting-started/PubNubConnection.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/getting-started/getting-started/PubNubConnection.swift b/getting-started/getting-started/PubNubConnection.swift index 65b4df4..772c614 100644 --- a/getting-started/getting-started/PubNubConnection.swift +++ b/getting-started/getting-started/PubNubConnection.swift @@ -11,8 +11,8 @@ import Foundation import PubNub final class PubNubConnection { - private static let PUBNUB_PUBLISH_KEY = "pub-c-7ae1c68f-8009-470a-83d6-b14848591f3a" - private static let PUBNUB_SUBSCRIBE_KEY = "sub-c-a7cb2610-ad18-4a4a-a5db-188271558045" + private static let PUBNUB_PUBLISH_KEY = "myPublishKey" + private static let PUBNUB_SUBSCRIBE_KEY = "mySubscribeKey" static let shared : PubNub = PubNub( configuration: PubNubConfiguration( publishKey: PUBNUB_PUBLISH_KEY, From f344fd498b0013ba80c8d02ca491ef3187fb4d3a Mon Sep 17 00:00:00 2001 From: olivercarson-pubnub <98775701+olivercarson-pubnub@users.noreply.github.com> Date: Sat, 30 Jul 2022 11:11:24 -0700 Subject: [PATCH 4/7] Updated readme --- README.md | 92 ++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 74 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 9972392..2b83561 100644 --- a/README.md +++ b/README.md @@ -1,30 +1,86 @@ -## IN PROGRESS ## +# Adding Push Notification to an iOS Swift Application Using APNs +This application builds upon [PubNub's iOS Chat Components Application](https://github.com/pubnub/chat-components-ios-examples) by adding Apple push notifications. You'll be using PubNub to construct and send push notification payloads to the Apple Push Notification Service (APNs) to deliver the notifications to your device. A [detailed tutorial](https://www.pubnub.com/tutorials/push-notifications-ios-swift/) is available for a step-by-step guide. -# Samples for PubNub Chat Components for iOS +Getting Started app for iOS -This repository contains a set of iOS projects that will help you learn about PubNub Chat Components for iOS. +## Features -Each sample application demonstrates a different type of chat, set of features, and use case. +* Pre-built UI Component that renders and handles displaying the chat room. +* Send messages to other users in the chat room. +* Receive messages from other users in the chat room. +* See past messages from other users in the chat room, even if the current user is offline. +* See typing indicators from users in the [debug console](https://www.pubnub.com/docs/console) and interact with the Android app in real-time. +* Receive and display push notifications, regardless of application state -## Prerequisites +## Installing / Getting started -You need these to get started: +### Requirements +- [Xcode](https://developer.apple.com/xcode/) (The latest stable version) +- [Git](https://www.atlassian.com/git/tutorials/install-git) +- [Apple Developer Account](https://developer.apple.com/account) with access to the Apple Developer Program. You'll need to be enrolled in this program in order to access services that allow your application to receive push notifications from APNs. Please note that this is a paid program. +- Physical iOS Device (iPhone, iPad, iPod Touch, etc). Simulated devices in Xcode cannot be registered in APNs, and thus cannot receive a device token, which is necessary when sending push notifications across the PubNub network. +- [PubNub Account](#pubnub-account) (*Free*) -* [Xcode](https://developer.apple.com/xcode/) (>= Xcode 13) -* [PubNub Keyset](https://dashboard.pubnub.com/) + + PubNub Signup + -Clone this project and open a given app in Xcode. If you're authenticated into Xcode with your GitHub account, you can also open the project directly from GitHub using the [Open in Xcode](https://github.blog/2017-06-05-clone-in-xcode/) button. +### Get Your PubNub Keys +1. Sign in to your [PubNub Dashboard](https://admin.pubnub.com/). You are now in the Admin Portal. +2. Go to Apps using the left-hand side navigation. +3. Click the Create New App button in the top-right of the Portal. +4. Give your app a name. +5. Click Create. +6. Click your new app to open its settings. +7. When you create a new app, the first set of keys are generated automatically. However, a single app can have as many keysets as you like. PubNub recommends that you create separate keysets for production and test environments. +8. Click on the keyset. +9. Enable four features for the keyset to be able to connect to the PubNub Network: Presence, Message Persistence, Stream Controller, and Mobile Push Notifications. +10. Enable Presence by clicking on the slider to turn it on. A pop-up will require that you enter in “ENABLE”. Enter in “ENABLE” in all caps and then press the “Enable” button. You can leave the default settings. +11. Enable Message Persistence by clicking on the slider to turn it on. You can leave the default settings. +12. Enable Stream Controller by clicking on the slider to turn it on if it is already not enabled. You can leave the default settings. +13. Enable Push Notifications by clicking on the slider to turn it on. In the Apple Push Credentials section, you need to upload the APNs Authentication Token file. This file is obtained from your Apple Developer Account when you create your Key in Certificates, Identifiers & Profiles -> Keys -> Register a New Key -> Give the key a name and enable APNs -> Click continue, register, and then download. If you no longer have access to the token file, you'll need to register and create a new key. Upload the token file. Enter in the Team ID and Auth Key ID fields found in the following locations in your Apple Developer Account. Team ID: Overview -> Membership -> Team ID; Auth Key ID: Overview -> Certificates, IDs & Profiles -> Keys -> Key ID in View Key Details. +14. Click on save changes. +15. Copy the Publish and Subscribe Keys to a text editor. -## Sample apps +### Building and Running +1. Clone the GitHub repository. -Choose a sample application that demonstrates the use of chat components. + ```bash + git clone https://github.com/PubNubDevelopers/ios-push-notifications-tutorial.git + ``` +2. Open your project in Xcode. Sign in using your developer account if you have not done so. +3. In the project navigator, click on the project file. In the Targets section, click on your project. +4. In the General tab, enter a unique Bundle Identifier by appending something like -push at the end of the ID. APNs identifies your application in a provisioning profile by combining a Team ID (generated by Apple) and your Bundle Identifier as an explicit App ID to be able to use certain capabilities, including receiving push notifications for your application. +5. Click on the Signing & Capabilities tab. +6. Ensure that the checkbox for "Automatically manage signing" is checked. +7. In the Signing section, ensure that your developer account is selected in the Team drop-down. +8. Ensure the Bundle Identifier is the same as that in the General tab. +9. Add Push Notification support to your application by clicking on the + symbol, search for "push notifications", and then double click the Capability to add to your application. +10. This application utilizes the PubNub Swift SDK and Chat Components for iOS libraries. Add these packages by clicking on File -> Add Packages and entering the following package URL: https://github.com/pubnub/chat-components-ios. +11. Navigate to AppDelegate.swift. At the top of the file, ensure that the PubNub library necessary to be able to use the PubNub Swift SDK is already imported. Add the UserNotifications library to be able to use push notifications in your project. +12. Connect and register physical Apple Device. +13. Build and run app by pressing the play button. +14. Send and receive messages, and view past messages from other users. +15. Generate new users each time the application is restarted. +16. Receive messages in real-time by interacting with the [debug console](https://www.pubnub.com/docs/console). +17. Incorporate push functionality. -| Name | Features | Chat type | Use case | -|-----|---------|---------|---------| -| [`getting-started`](getting-started/) |
  • Message list and message input integration
  • Light & dark themes

| 1:1 | Getting Started app for iOS | +## Links -## Useful links +- Project homepage: https://pubnub.com +- Tutorial Link: https://www.pubnub.com/tutorials/push-notifications-ios-swift/ +- Swift Weather Application integrated with chat using PubNub's Chat Components for iOS: https://github.com/PubNubDevelopers/Swift-Weather-Chat/ -For more information about PubNub Chat Components for iOS, refer to: -* [GitHub repository](https://github.com/pubnub/chat-components-ios/blob/master/README.md) -* [Documentation](https://www.pubnub.com/docs/chat/components/ios/get-started-ios) +## License +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +``` From a184e9a8e81d53a4495386b150038bad5967c394 Mon Sep 17 00:00:00 2001 From: olivercarson-pubnub <98775701+olivercarson-pubnub@users.noreply.github.com> Date: Fri, 5 May 2023 12:16:51 -0700 Subject: [PATCH 5/7] Update README.md --- README.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 2b83561..3e8b266 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -# Adding Push Notification to an iOS Swift Application Using APNs -This application builds upon [PubNub's iOS Chat Components Application](https://github.com/pubnub/chat-components-ios-examples) by adding Apple push notifications. You'll be using PubNub to construct and send push notification payloads to the Apple Push Notification Service (APNs) to deliver the notifications to your device. A [detailed tutorial](https://www.pubnub.com/tutorials/push-notifications-ios-swift/) is available for a step-by-step guide. +# Adding Mobile Push Notification to an iOS Swift Application Using APNs +This application builds upon [PubNub's iOS Chat Components Application](https://github.com/pubnub/chat-components-ios-examples) by adding Apple push notifications. You'll be using PubNub to construct and send mobile push notification payloads to the Apple Push Notification Service (APNs) to deliver the notifications to your device. A [detailed tutorial](https://www.pubnub.com/tutorials/mobile-push-notifications-ios-swift/) is available for a step-by-step guide. Getting Started app for iOS @@ -9,16 +9,16 @@ This application builds upon [PubNub's iOS Chat Components Application](https:// * Send messages to other users in the chat room. * Receive messages from other users in the chat room. * See past messages from other users in the chat room, even if the current user is offline. -* See typing indicators from users in the [debug console](https://www.pubnub.com/docs/console) and interact with the Android app in real-time. -* Receive and display push notifications, regardless of application state +* See message actions from users in the [debug console](https://www.pubnub.com/docs/console) and interact with the Android app in real-time. +* Receive and display mobile push notifications, regardless of application state ## Installing / Getting started ### Requirements - [Xcode](https://developer.apple.com/xcode/) (The latest stable version) - [Git](https://www.atlassian.com/git/tutorials/install-git) -- [Apple Developer Account](https://developer.apple.com/account) with access to the Apple Developer Program. You'll need to be enrolled in this program in order to access services that allow your application to receive push notifications from APNs. Please note that this is a paid program. -- Physical iOS Device (iPhone, iPad, iPod Touch, etc). Simulated devices in Xcode cannot be registered in APNs, and thus cannot receive a device token, which is necessary when sending push notifications across the PubNub network. +- [Apple Developer Account](https://developer.apple.com/account) with access to the Apple Developer Program. You'll need to be enrolled in this program in order to access services that allow your application to receive mobile push notifications from APNs. Please note that this is a paid program. +- Physical iOS Device (iPhone, iPad, iPod Touch, etc). Simulated devices in Xcode cannot be registered in APNs, and thus cannot receive a device token, which is necessary when sending mobile push notifications across the PubNub network. - [PubNub Account](#pubnub-account) (*Free*) @@ -38,7 +38,7 @@ This application builds upon [PubNub's iOS Chat Components Application](https:// 10. Enable Presence by clicking on the slider to turn it on. A pop-up will require that you enter in “ENABLE”. Enter in “ENABLE” in all caps and then press the “Enable” button. You can leave the default settings. 11. Enable Message Persistence by clicking on the slider to turn it on. You can leave the default settings. 12. Enable Stream Controller by clicking on the slider to turn it on if it is already not enabled. You can leave the default settings. -13. Enable Push Notifications by clicking on the slider to turn it on. In the Apple Push Credentials section, you need to upload the APNs Authentication Token file. This file is obtained from your Apple Developer Account when you create your Key in Certificates, Identifiers & Profiles -> Keys -> Register a New Key -> Give the key a name and enable APNs -> Click continue, register, and then download. If you no longer have access to the token file, you'll need to register and create a new key. Upload the token file. Enter in the Team ID and Auth Key ID fields found in the following locations in your Apple Developer Account. Team ID: Overview -> Membership -> Team ID; Auth Key ID: Overview -> Certificates, IDs & Profiles -> Keys -> Key ID in View Key Details. +13. Enable Mobile Push Notifications by clicking on the slider to turn it on. In the Apple Push Credentials section, you need to upload the APNs Authentication Token file. This file is obtained from your Apple Developer Account when you create your Key in Certificates, Identifiers & Profiles -> Keys -> Register a New Key -> Give the key a name and enable APNs -> Click continue, register, and then download. If you no longer have access to the token file, you'll need to register and create a new key. Upload the token file. Enter in the Team ID and Auth Key ID fields found in the following locations in your Apple Developer Account. Team ID: Overview -> Membership -> Team ID; Auth Key ID: Overview -> Certificates, IDs & Profiles -> Keys -> Key ID in View Key Details. 14. Click on save changes. 15. Copy the Publish and Subscribe Keys to a text editor. @@ -50,14 +50,14 @@ This application builds upon [PubNub's iOS Chat Components Application](https:// ``` 2. Open your project in Xcode. Sign in using your developer account if you have not done so. 3. In the project navigator, click on the project file. In the Targets section, click on your project. -4. In the General tab, enter a unique Bundle Identifier by appending something like -push at the end of the ID. APNs identifies your application in a provisioning profile by combining a Team ID (generated by Apple) and your Bundle Identifier as an explicit App ID to be able to use certain capabilities, including receiving push notifications for your application. +4. In the General tab, enter a unique Bundle Identifier by appending something like -push at the end of the ID. APNs identifies your application in a provisioning profile by combining a Team ID (generated by Apple) and your Bundle Identifier as an explicit App ID to be able to use certain capabilities, including receiving mobile push notifications for your application. 5. Click on the Signing & Capabilities tab. 6. Ensure that the checkbox for "Automatically manage signing" is checked. 7. In the Signing section, ensure that your developer account is selected in the Team drop-down. 8. Ensure the Bundle Identifier is the same as that in the General tab. -9. Add Push Notification support to your application by clicking on the + symbol, search for "push notifications", and then double click the Capability to add to your application. +9. Add Mobile Push Notification support to your application by clicking on the + symbol, search for "push notifications", and then double click the Capability to add to your application. 10. This application utilizes the PubNub Swift SDK and Chat Components for iOS libraries. Add these packages by clicking on File -> Add Packages and entering the following package URL: https://github.com/pubnub/chat-components-ios. -11. Navigate to AppDelegate.swift. At the top of the file, ensure that the PubNub library necessary to be able to use the PubNub Swift SDK is already imported. Add the UserNotifications library to be able to use push notifications in your project. +11. Navigate to AppDelegate.swift. At the top of the file, ensure that the PubNub library necessary to be able to use the PubNub Swift SDK is already imported. Add the UserNotifications library to be able to use mobile push notifications in your project. 12. Connect and register physical Apple Device. 13. Build and run app by pressing the play button. 14. Send and receive messages, and view past messages from other users. @@ -68,7 +68,7 @@ This application builds upon [PubNub's iOS Chat Components Application](https:// ## Links - Project homepage: https://pubnub.com -- Tutorial Link: https://www.pubnub.com/tutorials/push-notifications-ios-swift/ +- Tutorial Link: https://www.pubnub.com/tutorials/mobile-push-notifications-ios-swift/ - Swift Weather Application integrated with chat using PubNub's Chat Components for iOS: https://github.com/PubNubDevelopers/Swift-Weather-Chat/ ## License From d799ca83680b0dc199fcf03e80787790dc54d3f8 Mon Sep 17 00:00:00 2001 From: olivercarson-pubnub <98775701+olivercarson-pubnub@users.noreply.github.com> Date: Fri, 5 May 2023 12:18:25 -0700 Subject: [PATCH 6/7] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3e8b266..1965d7d 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ This application builds upon [PubNub's iOS Chat Components Application](https:// * Send messages to other users in the chat room. * Receive messages from other users in the chat room. * See past messages from other users in the chat room, even if the current user is offline. -* See message actions from users in the [debug console](https://www.pubnub.com/docs/console) and interact with the Android app in real-time. +* See message reactions from users in the [debug console](https://www.pubnub.com/docs/console) and interact with the Android app in real-time. * Receive and display mobile push notifications, regardless of application state ## Installing / Getting started From 1c85b293d76b00c7e414c8a2753171d6a8657cb3 Mon Sep 17 00:00:00 2001 From: olivercarson-pubnub <98775701+olivercarson-pubnub@users.noreply.github.com> Date: Fri, 5 May 2023 12:19:52 -0700 Subject: [PATCH 7/7] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1965d7d..9922d4e 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ This application builds upon [PubNub's iOS Chat Components Application](https:// * Send messages to other users in the chat room. * Receive messages from other users in the chat room. * See past messages from other users in the chat room, even if the current user is offline. -* See message reactions from users in the [debug console](https://www.pubnub.com/docs/console) and interact with the Android app in real-time. +* See message reactions from users in the [debug console](https://www.pubnub.com/docs/console) and interact with the iOS app in real-time. * Receive and display mobile push notifications, regardless of application state ## Installing / Getting started