Message:

iOS (16 posts)

google-signin-backendlessWe supported Google Sign in for a while, however, the feature was not properly documented. Not anymore )) The documentation has been updated for Android and iOS SDKs. Using the “Login with Google” function, an app can provide a way for the users to login using their Google credentials. Once a user is authenticated, Backendless creates an internal account and starts a logged-in session.

See Backendless documentation for details:

Android SDK

iOS SDK

The recording of the “Push Notifications” webinar which we conducted earlier this month is now available in our YouTube channel. You watch the webinar below or on the Webinars page on our website. In the webinar we reviewed the process of setting up an Android and an iOS apps as well as the backend to be able to register device and receive push notifications.

We conducted a webinar titled “Backendless Core Concepts” for ex-Parses last week. A recording of the webinar is now available. The video should be helpful not only if you’re coming from Parse, but for anyone who is starting their journey with Backendless. The webinar reviewed the concepts of Backendless User and Data services. Specifically, we focused on:

  • user properties
  • setting up user relations
  • registering a user
  • registering a user with custom properties
  • configuring a data model
  • code-driven schema creation
  • data relations
  • a brief overview of Cloud Code

Video broadcasting and streaming is one of the coolest features of Backendless. Our Media Service API enables client-server functionality for working with live and on-demand audio and video content. A mobile application which uses the Media Service API can broadcast audio and video from the device’s cameras and microphone. Backendless automatically handles streaming of the received media content to other clients or recording of the content on the server. The API can also support the capability to stream a pre-recorded (on-demand) content managed by the Media Service. More details about these features are available in the Media Service documentation.

This post describes how to build an iOS application using the Swift language. The app will record a video on the server and then subsequently play it back.

Continue reading

We just pushed a new release to our production servers. The release includes multiple new features and a ton of improvements. Below is a summary of what went into the release. There will be a blog post with a video providing an in-depth review of each new feature:

Continue reading

CocoaPods manages library dependencies for your Xcode projects.

The dependencies for your projects are specified in a single text file called “Podfile”. CocoaPods resolves dependencies between libraries, fetches necessary code and links it together in an Xcode workspace to build your project.

Continue reading
Posted in iOS

Establishing relations between user objects and other entities in an application is a very common use case. This post describes various scenarios and shows sample code using Backendless SDK for Java/Android and Backendless SDK for iOS. Make sure the version of the client libraries are at least 1.5 for Backendless Java/Android and 1.11 for iOS.

Continue reading
Posted in Android, Examples, iOS

One of the coolest features included into our November release is support for mobile audio/video conferencing, screen and gesture sharing. This functionality is made possible through our partnership with ShowKit – a mobile SDK for iOS and other environments. Integration with Backendless makes it trivially easy to enable the users of your mobile app to conference with each other and share app screens. Complete documentation describing the integration is available in the Backendless Media Service API doc as well as ShowKit’s website.

In this blog post we review the process of setting up and developing an iOS application capable to receive Apple Push Notifications. We also review the functionality of publishing a push notification through Backendless.

Creating App ID

  1. First we are going to create an App ID for the application which will receive Push Notifications. Login to Apple Developer Member Center. Click on “App IDs” in the “Identifiers” section. Use the plus sign “+” button to create a new ID:
  2. When prompted enter App ID Prefix. Make sure it is descriptive enough so you recognize it later when you return to the Member Center.
  3. Select Explicit App ID in the “App ID Suffix” section and enter the same bundle ID which you will be using in the application:
  4. In App Services select the services which the application will use and click “continue”:
  5. Make sure that Push Notifications are enabled and click “submit”. This will conclude the App ID creation for the app:

Creating Certificate Request

Push Notifications require a certificate which will be used on a device by the means of a provisioning profile. Also the same certificate (transformed to the Personal Information Exchange – .p12 format) will be used by Backendless to publish Push Notifications. If this makes little sense, do not worry, you will need to perform these steps only ones and then can move on to code and using the APIs.

  1. In order to create a certificate a Certificate Signing Request (CSR) must be issued. To create a CSR, open Keychain Access and select Keychain Access >> Certificate Assistant >> Request a Certificate from the main menu:
  2. Enter your email address and Common Name (leave the CA Email Address field empty), select “Saved to disk” and click “Continue”:
  3. Select a directory where to save the file and click Save.

Generating an SSL Certificate for Push Notifications

The CSR file created in the section above will be used to create an SSL Certificate. That certificate will then be used by Backendless to publish push notifications.

  1. Return to Apple Developer Member Center and select “All” under “Certificates”. Click the plus button “+” to add a new certificate:
  2. Select certificate type – there are two options Development and Production. For now select “Apple Push Notification service SSL (Sandbox)”:
  3. Select the App ID created earlier in these instructions:
  4. Next you will see the instructions for generating a CSR which you have already created by now. Click Continue to proceed to the next step.
  5. Select the CSR file created and saved to the disk earlier and click Generate:
  6. The certificate is ready now, click “Download” to download it:
  7. Add the certificate file to Keychain Access.
  8. Open Keychain Access and locate the certificate in the “My Certificates” section:
  9. Right click on the certificate and select the Export option:
  10. Save the certificate in the p12 format:
  11. Enter a password for the certificate. Make sure to make a record of the password – you will need to use it later in the instructions when you submit the certificate to Backendless:
  12. Enter your Mac OS X account password to confirm the action. At this point you have a certificate for Push Notifications.

Configuring Backendless App with the Certificate

Since Backendless provides the actual server-side integration for delivering Push Notifications for your application, it needs to have access to the certificate you created above. The steps below provide the instructions for uploading the certificate into Backendless:

  1. Login to Backendless Console at: https://backendless.com/develop and create/select an application which you will use on the server-side:

  2. Click Manage > App Settings. Locate the Mobile Settings section and upload the .p12 certificate created earlier. Make sure to enter the same password you used when created the certificate:

  3. Now your Backendless server is ready to publish Push Notifications.

Creating Provisioning Profile

  1. Login to Apple Developer Member Center and select “All” under Provisioning Profiles. Click the plus button “+” to create a new profile:
  2. Select the “iOS App Development” profile type:
  3. Click Continue. On the next screen select the App ID which was created earlier:
  4.  Click Continue. Select the users/certificates which will be included into the profile.
  5. Click Continue. Select the devices to include into the profile.
  6. Click Continue. Enter a name to assign to the profile and click Generate:
  7. Download the profile:
  8. Start XCode and open Organizer. Select the Provisioning Profiles section and add the profile you generated/downloaded:

Creating App in XCode

Finally all the setup is done and we can proceed to the fun part – creating an app in XCode and writing some code.

  1. Open XCode and create new “Single View Application”.
  2. Enter “pushNotificationSample” as the Product Name. Also provide your organization name and company identifier. Since the bundle ID we used when creating App ID earlier was “com.backendless.pushNotificationSample”, you should use “com.backendless” as the “Company Identifier”:
  3. Once the application is created, open Targets > Build Settings > Code Signing > Code Signing Identity and select the provisioning profile created earlier:



  4. At this point you should add Backendless SDK to your project. This includes adding Backendless library and its dependencies. Additionally, you will need to copy/paste Backendless Application ID and Secret Key into the code. For detailed instructions on how to do that, please follow the Backendless Quick Start Guide for iOS.
  5. Open AppDeletage.m. The following code registers the device with Backendless and Apple Push Notification Service:

    If the registration goes through, the following method is automatically called with the device token passed as the argument:

    Otherwise, if the registration fails, the following method is called with the argument of the underlying error:

    In case of the successful registration, the device is ready to accept published Push Notifications. When a notification is delivered to a device, the following method is invoked when the app is running.
  6. In order to send a Push Notification from a device, use the following code:

Publishing Push Notifications from Backendless Console

  1. Open Backendless Console at https://backendless.com/develop and select the Messaging section.
  2. Enter the text of the notification message in the “Message text” area, also make sure to specify the headers:
    1. “ios-badge”:”X”, where X is the number for the badge update
    2. “ios-alert”:”alert message text”
    3. “ios-sound”:”URL of the sound file”For a list of all supported headers, see the Publish Push Notification section in the documentation.
  3. Click the “iOS Devices” checkbox.
  4. Click Publish. The Push Notification will be delivered to all registered iOS devices:
  5. To see a list of the registered devices use the Devices tab. You can also send a push notification to specific devices. In order to do that, select the devices using the checkboxes and then click the “Selected devices” option under “Push Notification” section:

Blocks are a powerful C-language feature that is part of Cocoa application development. They are similar to “closures” and “lambdas” you may find in scripting and programming languages such as Ruby, Python, and Lisp. For a more in-depth review of blocks, see “a short practical guide to blocks”. A Backendless user has recently asked us about the ability to handle asynchronous APIs via block-based callbacks. Since this is a very reasonable request, we added support for blocks and it is available in the latest version of the Backendless SDK for iOS. Below is an example of using the new feature with the user registration and login APIs (btw, the feature is available for ALL Backendless APIs):

By the way, here is an example of code that does the same thing, but synchronously:

The example below demonstrates the usage of block callbacks with the Data Service API in order to:

  • Persist a complex type (an instance of class Weather)
  • Find an object by ID
  • Finding first and last instances
  • Deleting an object by its objectId

If you prefer to use the synchronous (blocking) API, the follow code does the same thing as the example above (but synchronously):

Enjoy!

Posted in Examples, iOS