This repo is for the catapult reference app in ios
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
BWSip.framework
BandwidthAppPlatform
BandwidthAppPlatformTests
MessageApi.xcodeproj
MessageApi.xcworkspace
MsgApi.framework
.gitignore
.gitmodules
CODE_OF_CONDUCT.md
CONTRIBUTING.md
ISSUE_TEMPLATE.md
LICENSE
PULLREQUEST.md
PULL_REQUEST_TEMPLATE.md
Podfile
Podfile.lock
README.md

README.md

Catapult Mobile Reference App-IOS

This repo is for the catapult reference app in ios

Install

Clone this repository

git clone git@github.com:inetCatapult/catapult-mobile-reference-app-ios.git 

If you don't have CocoaPods installed do that by

sudo gem install cocoapods

Install external dependecies by

pod install

Open in Xcode MessageApi.xcworkspace.

Open file Settings.swift and change next items:

baseAcmeUrl - base url of acme app (without last slash, like http://your-host).

Change bundle identifier of the project (current value is com.bandwidth.MessageApi, required to add push notifications support in IOS developer center).

Set up Push Notifications (see bellow)

Build the app.

Getting Started

  • Run acme app (it should be available from baseAcmeUrl)
  • Install and run this app on real iphone.

Tune on internet access on this iphone via wifi or mobile data. Don't use ios emulator. Push notifications are not supported by emulator

User registration screen will be shown on the first run. Enter your user name and press "Register". You should see screen with settings on success (acme app should do a registration).

Switch to tab "Messages". The app will connect to MMP server to get all exiting messages and start listen to incoming messages via websocket. Enter in editor text in format to:<to-number> <text-to-send> (like to:+1234567890 hello) and press 'Send' to send this message. This message will be sent via request to MMP server. You'll see it in message list on success. Any incoming message will be shown in message list too.

Dependencies

  • MsgApi.framework (included),
  • JCDialPad (via cocoapods, dialer ui),
  • JSQMessagesViewController (via cocoapods, messages ui),
  • FontasticIcons (via cocoapods, set of icons),

Push notification

To enable push notifications on this app do next steps:

Generate Certificate Signing Request (CSR)

Open "Keychain Access" on your Mac (it is in Applications/Utilities) and choose the menu option "Request a Certificate from a Certificate Authority…" (in "Keychain access" -> "Certificate Assistant"). Fill your email and common name (like MessageApi on another). Select Saved to disk and press "Continue". Save your file (we will use file name MessageApi.certSigningRequest here).

If you go to the Keys section of "Keychain Access", you will see that a new private key has appeared in your keychain. Right click it and choose Export. Save the private key as MessagApiKey.p12 (or with another name).

Convert your private key to pem format

openssl pkcs12 -nocerts -out MessageApiKey.pem -in MessageApiKey.p12

Make SSL Certificate

Go to IOS developer center's App Ids, log in if need and add new app id (button with "+" on the top). Enter any "Name" you want (like MessageApi Demo) and com.bandwidth.MessageApi (or your own value if you changed it) to "Bundle Id". Set checkbox "Push Notifications" in "App Services" and press "Continue".

Select created app id from list and press "Settings" (on the bottom). Scroll down to the "Push Notifications" section and select the "Create Certificate" button in the "Development SSL Certificate section". The first thing it asks you is to generate a Certificate Signing Request. You already did that, so click Continue. In the next step you upload the CSR. Choose the CSR file that you generated earlier and click "Generate". Now click "Download" to get the certificate – it is named aps_development.cer.

Convert downloaded certificate to pem format by command

openssl x509 -in aps_development.cer -inform der -out MessageApiCert.pem

Upload certificates to the MMP server

Upload created pem files to the MMP server.

curl -u <api-token>:<api-secret> -H 'Content-Type: application/json' -d '{"certificate" : "<MessageApiCert.pem content>", "privateKey" : "<MessageApiKey.pem content>"}' -XPUT 'http://api-stage.bwmsg.io/partners/<partner>/domains/<domain>/pushCredentials/apns_sandbox'

May be you have to install [Entrust CA root certificate](https://www.entrust.net/downloads/binary/entrust_2048_ca.cer You then also need to add) there.

Create Provisioning Profile

Go to Provision profiles and create a provision profile (button with "+"). Select the "iOS App development" option button in the first step of the wizard and press "Continue". Select the created app id that you created in the previous section. Press "Continue". Select create certificate to include it into provision profile. Press "Continue". Select your iphone (and othe devices if you want) where this application will be ran. Press "Continue". Enter profile name and press "Generate" and then "Download". Open downloaded file with Xcode to import settings.

Rebuid an run the application

Open this application in Xcode and rebuilt it. Run it on iphone which you added to the provision profile. Push notifications should work now.

See more details about configuring of push notifications here